17 return fmax(
tol(ic1),
tol(ic2));
21 return (-tolerance <= x) && (x <= tolerance);
28 return (-tolerance <= diff) && (diff <= tolerance);
34 return x <= (y + tolerance);
40 return (x + tolerance) >= y;
48 auto compressed_coords =
reinterpret_cast<int32_t*
>(data);
49 auto compressed_coord = compressed_coords[index];
56 auto double_coords =
reinterpret_cast<double*
>(data);
57 return double_coords[index];
91 auto decompressed_transformed_coord_x =
93 return decompressed_transformed_coord_x;
103 auto decompressed_transformed_coord_y =
105 return decompressed_transformed_coord_y;
152 double dotprod = (px - l1x) * (l2x - l1x) + (py - l1y) * (l2y - l1y);
153 double k = dotprod / (length * length);
154 k = fmax(0.0, fmin(1.0, k));
155 double projx = l1x + k * (l2x - l1x);
156 double projy = l1y + k * (l2y - l1y);
168 return (
tol_le(qx, fmax(px, rx)) &&
tol_ge(qx, fmin(px, rx)) &&
173 orientation(
double px,
double py,
double qx,
double qy,
double rx,
double ry) {
174 auto val = ((qy - py) * (rx - qx) - (qx - px) * (ry - qy));
194 auto o1 =
orientation(l11x, l11y, l12x, l12y, l21x, l21y);
195 auto o2 =
orientation(l11x, l11y, l12x, l12y, l22x, l22y);
196 auto o3 =
orientation(l21x, l21y, l22x, l22y, l11x, l11y);
197 auto o4 =
orientation(l21x, l21y, l22x, l22y, l12x, l12y);
200 if (o1 != o2 && o3 != o4) {
206 if (o1 == 0 &&
on_segment(l11x, l11y, l21x, l21y, l12x, l12y)) {
211 if (o2 == 0 &&
on_segment(l11x, l11y, l22x, l22y, l12x, l12y)) {
216 if (o3 == 0 &&
on_segment(l21x, l21y, l11x, l11y, l22x, l22y)) {
221 if (o4 == 0 &&
on_segment(l21x, l21y, l12x, l12y, l22x, l22y)) {
238 double e1x =
coord_x(l, 0, ic1, isr1, osr);
239 double e1y =
coord_y(l, 1, ic1, isr1, osr);
240 for (int64_t i = 2; i < lnum_coords; i += 2) {
241 double e2x =
coord_x(l, i, ic1, isr1, osr);
242 double e2y =
coord_y(l, i + 1, ic1, isr1, osr);
254 int32_t ring_num_coords,
262 double e1x =
coord_x(ring, ring_num_coords - 2, ic1, isr1, osr);
263 double e1y =
coord_y(ring, ring_num_coords - 1, ic1, isr1, osr);
264 double e2x =
coord_x(ring, 0, ic1, isr1, osr);
265 double e2y =
coord_y(ring, 1, ic1, isr1, osr);
270 ring, ring_num_coords, l1x, l1y, l2x, l2y, ic1, isr1, osr);
283 double e1x =
coord_x(l, 0, ic1, isr1, osr);
284 double e1y =
coord_y(l, 1, ic1, isr1, osr);
285 for (int64_t i = 2; i < lnum_coords; i += 2) {
286 double e2x =
coord_x(l, i, ic1, isr1, osr);
287 double e2y =
coord_y(l, i + 1, ic1, isr1, osr);
314 return fmin(dist12, dist21);
319 int32_t ring_num_coords,
327 double min_distance = 0.0;
329 double re1x =
coord_x(ring, ring_num_coords - 2, ic1, isr1, osr);
330 double re1y =
coord_y(ring, ring_num_coords - 1, ic1, isr1, osr);
331 for (
auto i = 0; i < ring_num_coords; i += 2) {
332 double re2x =
coord_x(ring, i, ic1, isr1, osr);
333 double re2y =
coord_y(ring, i + 1, ic1, isr1, osr);
335 double le1x =
coord_x(l, 0, ic2, isr2, osr);
336 double le1y =
coord_y(l, 1, ic2, isr2, osr);
337 for (
auto j = 2; j < lnum_coords; j += 2) {
338 double le2x =
coord_x(l, j, ic2, isr2, osr);
339 double le2y =
coord_y(l, j + 1, ic2, isr2, osr);
342 if ((i == 0 && j == 2) || min_distance > distance) {
343 min_distance = distance;
360 int32_t ring1_num_coords,
362 int32_t ring2_num_coords,
368 double min_distance = 0.0;
370 double e11x =
coord_x(ring1, ring1_num_coords - 2, ic1, isr1, osr);
371 double e11y =
coord_y(ring1, ring1_num_coords - 1, ic1, isr1, osr);
372 for (
auto i = 0; i < ring1_num_coords; i += 2) {
373 double e12x =
coord_x(ring1, i, ic1, isr1, osr);
374 double e12y =
coord_y(ring1, i + 1, ic1, isr1, osr);
376 double e21x =
coord_x(ring2, ring2_num_coords - 2, ic2, isr2, osr);
377 double e21y =
coord_y(ring2, ring2_num_coords - 1, ic2, isr2, osr);
378 for (
auto j = 0; j < ring2_num_coords; j += 2) {
379 double e22x =
coord_x(ring2, j, ic2, isr2, osr);
380 double e22y =
coord_y(ring2, j + 1, ic2, isr2, osr);
383 if ((i == 0 && j == 0) || min_distance > distance) {
384 min_distance = distance;
415 int32_t poly_num_coords,
423 bool horizontal_edge =
false;
424 bool yray_intersects =
false;
426 double e1x =
coord_x(poly, poly_num_coords - 2, ic1, isr1, osr);
427 double e1y =
coord_y(poly, poly_num_coords - 1, ic1, isr1, osr);
428 for (int64_t i = 0; i < poly_num_coords; i += 2) {
429 double e2x =
coord_x(poly, i, ic1, isr1, osr);
430 double e2y =
coord_y(poly, i + 1, ic1, isr1, osr);
444 horizontal_edge = (xray_touch != 0) &&
tol_eq(py, e1y) &&
tol_eq(py, e2y);
448 double xray = fmax(e2x, e1x) + 1.0;
463 if (xray_touch == 0) {
470 xray_touch = (e1y > py) ? 1 : -1;
475 if (xray_touch > 0) {
501 if (!yray_intersects) {
502 double yray = fmin(e2y, e1y) - 1.0;
519 if (!yray_intersects) {
530 int32_t poly_num_coords,
539 double l1x =
coord_x(l, 0, ic2, isr2, osr);
540 double l1y =
coord_y(l, 1, ic2, isr2, osr);
547 for (int32_t i = 2; i < lnum_coords; i += 2) {
548 double l2x =
coord_x(l, i, ic2, isr2, osr);
549 double l2y =
coord_y(l, i + 1, ic2, isr2, osr);
575 int64_t bounds1_size,
577 int64_t bounds2_size) {
580 bounds1, bounds1_size, bounds2[0], bounds2[1]) &&
582 bounds1, bounds1_size, bounds2[2], bounds2[3]));
586 int64_t bounds1_size,
588 int64_t bounds2_size) {
591 bounds1, bounds1_size, bounds2[0], bounds2[1]) ||
593 bounds1, bounds1_size, bounds2[2], bounds2[3]) ||
595 bounds1, bounds1_size, bounds2[0], bounds2[3]) ||
597 bounds1, bounds1_size, bounds2[2], bounds2[1]));
601 int64_t bounds1_size,
603 int64_t bounds2_size) {
605 if (bounds1[2] < bounds2[0] ||
606 bounds1[0] > bounds2[2] ||
607 bounds1[3] < bounds2[1] ||
608 bounds1[1] > bounds2[3]) {
615 double ST_X_Point(int8_t* p, int64_t psize, int32_t ic, int32_t isr, int32_t osr) {
616 return coord_x(p, 0, ic, isr, osr);
620 double ST_Y_Point(int8_t* p, int64_t psize, int32_t ic, int32_t isr, int32_t osr) {
621 return coord_y(p, 1, ic, isr, osr);
632 if (lindex < 0 || lindex > l_num_points) {
633 lindex = l_num_points;
635 return coord_x(l, 2 * (lindex - 1), ic, isr, osr);
646 if (lindex < 0 || lindex > l_num_points) {
647 lindex = l_num_points;
649 return coord_y(l, 2 * (lindex - 1) + 1, ic, isr, osr);
653 double ST_XMin(int8_t* coords, int64_t size, int32_t ic, int32_t isr, int32_t osr) {
656 for (int32_t i = 0; i < num_coords; i += 2) {
657 double x =
coord_x(coords, i, ic, isr, osr);
658 if (i == 0 || x < xmin) {
666 double ST_YMin(int8_t* coords, int64_t size, int32_t ic, int32_t isr, int32_t osr) {
669 for (int32_t i = 1; i < num_coords; i += 2) {
670 double y =
coord_y(coords, i, ic, isr, osr);
671 if (i == 1 || y < ymin) {
679 double ST_XMax(int8_t* coords, int64_t size, int32_t ic, int32_t isr, int32_t osr) {
682 for (int32_t i = 0; i < num_coords; i += 2) {
683 double x =
coord_x(coords, i, ic, isr, osr);
684 if (i == 0 || x > xmax) {
692 double ST_YMax(int8_t* coords, int64_t size, int32_t ic, int32_t isr, int32_t osr) {
695 for (int32_t i = 1; i < num_coords; i += 2) {
696 double y =
coord_y(coords, i, ic, isr, osr);
697 if (i == 1 || y > ymax) {
739 double l0x =
coord_x(l, 0, ic, isr, osr);
740 double l0y =
coord_y(l, 1, ic, isr, osr);
743 for (int32_t i = 2; i < l_num_coords; i += 2) {
746 l2x =
coord_x(l, i, ic, isr, osr);
747 l2y =
coord_y(l, i + 1, ic, isr, osr);
785 int32_t* poly_ring_sizes,
786 int64_t poly_num_rings,
790 if (poly_num_rings <= 0) {
794 auto exterior_ring_num_coords = poly_ring_sizes[0] * 2;
797 return length_linestring(poly, exterior_ring_coords_size, ic, isr, osr,
false,
true);
803 int32_t* poly_ring_sizes,
804 int64_t poly_num_rings,
808 if (poly_num_rings <= 0) {
812 auto exterior_ring_num_coords = poly_ring_sizes[0] * 2;
815 return length_linestring(poly, exterior_ring_coords_size, ic, isr, osr,
true,
true);
819 int64_t mpoly_coords_size,
820 int32_t* mpoly_ring_sizes,
821 int64_t mpoly_num_rings,
822 int32_t* mpoly_poly_sizes,
823 int64_t mpoly_num_polys,
828 if (mpoly_num_polys <= 0 || mpoly_num_rings <= 0) {
832 double perimeter = 0.0;
835 auto next_poly_coords = mpoly_coords;
836 auto next_poly_ring_sizes = mpoly_ring_sizes;
838 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
839 auto poly_coords = next_poly_coords;
840 auto poly_ring_sizes = next_poly_ring_sizes;
841 auto poly_num_rings = mpoly_poly_sizes[poly];
843 int32_t poly_num_coords = 0;
844 for (
auto ring = 0; ring < poly_num_rings; ring++) {
845 poly_num_coords += 2 * *next_poly_ring_sizes++;
848 next_poly_coords += poly_coords_size;
850 auto exterior_ring_num_coords = poly_ring_sizes[0] * 2;
854 poly_coords, exterior_ring_coords_size, ic, isr, osr, geodesic,
true);
862 int64_t mpoly_coords_size,
863 int32_t* mpoly_ring_sizes,
864 int64_t mpoly_num_rings,
865 int32_t* mpoly_poly_sizes,
866 int64_t mpoly_num_polys,
884 int64_t mpoly_coords_size,
885 int32_t* mpoly_ring_sizes,
886 int64_t mpoly_num_rings,
887 int32_t* mpoly_poly_sizes,
888 int64_t mpoly_num_polys,
914 return (x1 * y2 - x2 * y1 + x3 * y1 - x1 * y3 + x2 * y3 - x3 * y2) / 2.0;
924 if (ring_num_coords < 6) {
930 double x1 =
coord_x(ring, 0, ic, isr, osr);
931 double y1 =
coord_y(ring, 1, ic, isr, osr);
932 double x2 =
coord_x(ring, 2, ic, isr, osr);
933 double y2 =
coord_y(ring, 3, ic, isr, osr);
934 for (int32_t i = 4; i < ring_num_coords; i += 2) {
935 double x3 =
coord_x(ring, i, ic, isr, osr);
936 double y3 =
coord_y(ring, i + 1, ic, isr, osr);
945 int64_t poly_coords_size,
946 int32_t* poly_ring_sizes,
947 int64_t poly_num_rings,
951 if (poly_num_rings <= 0) {
956 auto ring_coords = poly_coords;
961 for (
auto r = 0; r < poly_num_rings; r++) {
963 area +=
area_ring(ring_coords, ring_coords_size, ic, isr, osr);
965 ring_coords += ring_coords_size;
972 int64_t poly_coords_size,
973 int32_t* poly_ring_sizes,
974 int64_t poly_num_rings,
979 poly_coords, poly_coords_size, poly_ring_sizes, poly_num_rings, ic, isr, osr);
984 int64_t poly_coords_size,
985 int32_t* poly_ring_sizes,
986 int64_t poly_num_rings,
991 poly_coords, poly_coords_size, poly_ring_sizes, poly_num_rings, ic, isr, osr);
996 int64_t mpoly_coords_size,
997 int32_t* mpoly_ring_sizes,
998 int64_t mpoly_num_rings,
999 int32_t* mpoly_poly_sizes,
1000 int64_t mpoly_num_polys,
1004 if (mpoly_num_rings <= 0 || mpoly_num_polys <= 0) {
1011 auto next_poly_coords = mpoly_coords;
1012 auto next_poly_ring_sizes = mpoly_ring_sizes;
1014 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
1015 auto poly_coords = next_poly_coords;
1016 auto poly_ring_sizes = next_poly_ring_sizes;
1017 auto poly_num_rings = mpoly_poly_sizes[poly];
1019 int32_t poly_num_coords = 0;
1020 for (
auto ring = 0; ring < poly_num_rings; ring++) {
1021 poly_num_coords += 2 * *next_poly_ring_sizes++;
1024 next_poly_coords += poly_coords_size;
1027 poly_coords, poly_coords_size, poly_ring_sizes, poly_num_rings, ic, isr, osr);
1034 int64_t mpoly_coords_size,
1035 int32_t* mpoly_ring_sizes,
1036 int64_t mpoly_num_rings,
1037 int32_t* mpoly_poly_sizes,
1038 int64_t mpoly_num_polys,
1076 return coord_y(p, 1, ic, isr, osr);
1078 return coord_x(p, 0, ic, isr, osr);
1086 double* linestring_centroid_sum) {
1089 double segment_midpoint_x = (x1 + x2) / 2.0;
1090 double segment_midpoint_y = (y1 + y2) / 2.0;
1091 linestring_centroid_sum[0] += ldist * segment_midpoint_x;
1092 linestring_centroid_sum[1] += ldist * segment_midpoint_y;
1102 double* total_length,
1103 double* linestring_centroid_sum,
1104 int64_t* num_points,
1105 double* point_centroid_sum) {
1107 double length = 0.0;
1108 double l0x =
coord_x(l, 0, ic, isr, osr);
1109 double l0y =
coord_y(l, 1, ic, isr, osr);
1112 for (int32_t i = 2; i < l_num_coords; i += 2) {
1115 l2x =
coord_x(l, i, ic, isr, osr);
1116 l2y =
coord_y(l, i + 1, ic, isr, osr);
1119 if (l_num_coords > 4 && closed) {
1123 *total_length += length;
1124 if (length == 0.0 && l_num_coords > 0) {
1126 point_centroid_sum[0] += l0x;
1127 point_centroid_sum[1] += l0y;
1139 double length = 0.0;
1140 double linestring_centroid_sum[2] = {0.0, 0.0};
1141 int64_t num_points = 0;
1142 double point_centroid_sum[2] = {0.0, 0.0};
1150 &linestring_centroid_sum[0],
1152 &point_centroid_sum[0]);
1153 double linestring_centroid[2] = {0.0, 0.0};
1155 linestring_centroid[0] = linestring_centroid_sum[0] / length;
1156 linestring_centroid[1] = linestring_centroid_sum[1] / length;
1157 }
else if (num_points > 0) {
1158 linestring_centroid[0] = point_centroid_sum[0] / num_points;
1159 linestring_centroid[1] = point_centroid_sum[1] / num_points;
1162 return linestring_centroid[1];
1164 return linestring_centroid[0];
1174 double* total_area2,
1176 double cx = x1 + x2 + x3;
1177 double cy = y1 + y2 + y3;
1178 double area2 = x1 * y2 - x2 * y1 + x3 * y1 - x1 * y3 + x2 * y3 - x3 * y2;
1179 cg3[0] += sign * area2 * cx;
1180 cg3[1] += sign * area2 * cy;
1181 *total_area2 += sign * area2;
1191 double* total_area2,
1193 double* total_length,
1194 double* linestring_centroid_sum,
1195 int64_t* num_points,
1196 double* point_centroid_sum) {
1199 if (ring_num_coords < 6) {
1203 double x1 =
coord_x(ring, 0, ic, isr, osr);
1204 double y1 =
coord_y(ring, 1, ic, isr, osr);
1205 double x2 =
coord_x(ring, 2, ic, isr, osr);
1206 double y2 =
coord_y(ring, 3, ic, isr, osr);
1207 for (int32_t i = 4; i < ring_num_coords; i += 2) {
1208 double x3 =
coord_x(ring, i, ic, isr, osr);
1209 double y3 =
coord_y(ring, i + 1, ic, isr, osr);
1222 linestring_centroid_sum,
1224 point_centroid_sum);
1229 int64_t poly_coords_size,
1230 int32_t* poly_ring_sizes,
1231 int64_t poly_num_rings,
1235 double* total_area2,
1237 double* total_length,
1238 double* linestring_centroid_sum,
1239 int64_t* num_points,
1240 double* point_centroid_sum) {
1241 if (poly_num_rings <= 0) {
1245 auto ring_coords = poly_coords;
1247 for (
auto r = 0; r < poly_num_rings; r++) {
1250 double sign = (r == 0) ? 1.0 : -1.0;
1260 linestring_centroid_sum,
1262 point_centroid_sum);
1264 ring_coords += ring_coords_size;
1271 int64_t poly_coords_size,
1272 int32_t* poly_ring_sizes,
1273 int64_t poly_num_rings,
1278 if (poly_num_rings <= 0) {
1281 double total_area2 = 0.0;
1282 double cg3[2] = {0.0, 0.0};
1283 double total_length = 0.0;
1284 double linestring_centroid_sum[2] = {0.0, 0.0};
1285 int64_t num_points = 0;
1286 double point_centroid_sum[2] = {0.0, 0.0};
1297 &linestring_centroid_sum[0],
1299 &point_centroid_sum[0]);
1301 double x1 =
coord_x(poly_coords, 0, ic, isr, osr);
1302 double y1 =
coord_y(poly_coords, 1, ic, isr, osr);
1303 double poly_centroid[2] = {x1, y1};
1304 if (total_area2 != 0.0) {
1305 poly_centroid[0] = cg3[0] / 3 / total_area2;
1306 poly_centroid[1] = cg3[1] / 3 / total_area2;
1307 }
else if (total_length > 0.0) {
1309 poly_centroid[0] = linestring_centroid_sum[0] / total_length;
1310 poly_centroid[1] = linestring_centroid_sum[1] / total_length;
1311 }
else if (num_points > 0) {
1313 poly_centroid[0] = point_centroid_sum[0] / num_points;
1314 poly_centroid[1] = point_centroid_sum[1] / num_points;
1318 return poly_centroid[1];
1320 return poly_centroid[0];
1325 int64_t mpoly_coords_size,
1326 int32_t* mpoly_ring_sizes,
1327 int64_t mpoly_num_rings,
1328 int32_t* mpoly_poly_sizes,
1329 int64_t mpoly_num_polys,
1334 if (mpoly_num_rings <= 0 || mpoly_num_polys <= 0) {
1338 double total_area2 = 0.0;
1339 double cg3[2] = {0.0, 0.0};
1340 double total_length = 0.0;
1341 double linestring_centroid_sum[2] = {0.0, 0.0};
1342 int64_t num_points = 0;
1343 double point_centroid_sum[2] = {0.0, 0.0};
1346 auto next_poly_coords = mpoly_coords;
1347 auto next_poly_ring_sizes = mpoly_ring_sizes;
1349 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
1350 auto poly_coords = next_poly_coords;
1351 auto poly_ring_sizes = next_poly_ring_sizes;
1352 auto poly_num_rings = mpoly_poly_sizes[poly];
1354 int32_t poly_num_coords = 0;
1355 for (
auto ring = 0; ring < poly_num_rings; ring++) {
1356 poly_num_coords += 2 * *next_poly_ring_sizes++;
1359 next_poly_coords += poly_coords_size;
1371 &linestring_centroid_sum[0],
1373 &point_centroid_sum[0]);
1376 double x1 =
coord_x(mpoly_coords, 0, ic, isr, osr);
1377 double y1 =
coord_y(mpoly_coords, 1, ic, isr, osr);
1378 double mpoly_centroid[2] = {x1, y1};
1379 if (total_area2 != 0.0) {
1380 mpoly_centroid[0] = cg3[0] / 3 / total_area2;
1381 mpoly_centroid[1] = cg3[1] / 3 / total_area2;
1382 }
else if (total_length > 0.0) {
1384 mpoly_centroid[0] = linestring_centroid_sum[0] / total_length;
1385 mpoly_centroid[1] = linestring_centroid_sum[1] / total_length;
1386 }
else if (num_points > 0) {
1388 mpoly_centroid[0] = point_centroid_sum[0] / num_points;
1389 mpoly_centroid[1] = point_centroid_sum[1] / num_points;
1393 return mpoly_centroid[1];
1395 return mpoly_centroid[0];
1399 int32_t
ST_NPoints(int8_t* coords, int64_t coords_sz, int32_t ic) {
1401 return static_cast<int32_t
>(num_pts / 2);
1405 int32_t
ST_NRings(int32_t* poly_ring_sizes, int64_t poly_num_rings) {
1406 return static_cast<int32_t
>(poly_num_rings);
1423 double p1x =
coord_x(p1, 0, ic1, isr1, osr);
1424 double p1y =
coord_y(p1, 1, ic1, isr1, osr);
1425 double p2x =
coord_x(p2, 0, ic2, isr2, osr);
1426 double p2y =
coord_y(p2, 1, ic2, isr2, osr);
1440 double p1x =
coord_x(p1, 0, ic1, isr1, osr);
1441 double p1y =
coord_y(p1, 1, ic1, isr1, osr);
1442 double p2x =
coord_x(p2, 0, ic2, isr2, osr);
1443 double p2y =
coord_y(p2, 1, ic2, isr2, osr);
1457 double p1x =
coord_x(p1, 0, ic1, 4326, 4326);
1458 double p1y =
coord_y(p1, 1, ic1, 4326, 4326);
1459 double p2x =
coord_x(p2, 0, ic2, 4326, 4326);
1460 double p2y =
coord_y(p2, 1, ic2, 4326, 4326);
1476 double px =
coord_x(p, 0, ic1, 4326, 4326);
1477 double py =
coord_y(p, 1, ic1, 4326, 4326);
1479 if (lindex < 0 || lindex > lpoints) {
1482 double lx =
coord_x(l, 2 * (lindex - 1), ic2, 4326, 4326);
1483 double ly =
coord_y(l, 2 * (lindex - 1) + 1, ic2, 4326, 4326);
1500 p, psize, l, lsize, lindex, ic2, isr2, ic1, isr1, osr);
1517 if (l1index < 0 || l1index > l1points) {
1520 double l1x =
coord_x(l1, 2 * (l1index - 1), ic1, 4326, 4326);
1521 double l1y =
coord_y(l1, 2 * (l1index - 1) + 1, ic1, 4326, 4326);
1523 if (l2index < 0 || l2index > l2points) {
1526 double l2x =
coord_x(l2, 2 * (l2index - 1), ic2, 4326, 4326);
1527 double l2y =
coord_y(l2, 2 * (l2index - 1) + 1, ic2, 4326, 4326);
1541 bool check_closed) {
1542 double px =
coord_x(p, 0, ic1, isr1, osr);
1543 double py =
coord_y(p, 1, ic1, isr1, osr);
1546 auto l_num_points = l_num_coords / 2;
1548 if (lindex < 0 || lindex > l_num_points) {
1549 lindex = l_num_points;
1551 double lx =
coord_x(l, 2 * (lindex - 1), ic2, isr2, osr);
1552 double ly =
coord_y(l, 2 * (lindex - 1) + 1, ic2, isr2, osr);
1556 double l1x =
coord_x(l, 0, ic2, isr2, osr);
1557 double l1y =
coord_y(l, 1, ic2, isr2, osr);
1558 double l2x =
coord_x(l, 2, ic2, isr2, osr);
1559 double l2y =
coord_y(l, 3, ic2, isr2, osr);
1562 for (int32_t i = 4; i < l_num_coords; i += 2) {
1565 l2x =
coord_x(l, i, ic2, isr2, osr);
1566 l2y =
coord_y(l, i + 1, ic2, isr2, osr);
1572 if (l_num_coords > 4 && check_closed) {
1574 l1x =
coord_x(l, 0, ic2, isr2, osr);
1575 l1y =
coord_y(l, 1, ic2, isr2, osr);
1596 p, psize, l, lsize, lindex, ic1, isr1, ic2, isr2, osr,
true);
1612 auto l_num_points = l_num_coords / 2;
1613 if (lindex < 0 || lindex > l_num_points) {
1614 lindex = l_num_points;
1616 double px =
coord_x(p, 0, ic1, isr1, osr);
1617 double py =
coord_y(p, 1, ic1, isr1, osr);
1618 double lx =
coord_x(l, 2 * (lindex - 1), ic2, isr2, osr);
1619 double ly =
coord_y(l, 2 * (lindex - 1) + 1, ic2, isr2, osr);
1624 p, psize, l, lsize, lindex, ic1, isr1, ic2, isr2, osr,
false);
1632 int32_t* poly_ring_sizes,
1633 int64_t poly_num_rings,
1640 if (poly_num_rings > 0) {
1641 exterior_ring_num_coords = poly_ring_sizes[0] * 2;
1645 double px =
coord_x(p, 0, ic1, isr1, osr);
1646 double py =
coord_y(p, 1, ic1, isr1, osr);
1650 p, psize, poly, exterior_ring_coords_size, 0, ic1, isr1, ic2, isr2, osr);
1654 poly += exterior_ring_coords_size;
1656 for (
auto r = 1; r < poly_num_rings; r++) {
1657 auto interior_ring_num_coords = poly_ring_sizes[r] * 2;
1658 auto interior_ring_coords_size =
1663 p, psize, poly, interior_ring_coords_size, 0, ic1, isr1, ic2, isr2, osr);
1665 poly += interior_ring_coords_size;
1673 int8_t* mpoly_coords,
1674 int64_t mpoly_coords_size,
1675 int32_t* mpoly_ring_sizes,
1676 int64_t mpoly_num_rings,
1677 int32_t* mpoly_poly_sizes,
1678 int64_t mpoly_num_polys,
1684 if (mpoly_num_polys <= 0) {
1687 double min_distance = 0.0;
1690 auto next_poly_coords = mpoly_coords;
1691 auto next_poly_ring_sizes = mpoly_ring_sizes;
1693 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
1694 auto poly_coords = next_poly_coords;
1695 auto poly_ring_sizes = next_poly_ring_sizes;
1696 auto poly_num_rings = mpoly_poly_sizes[poly];
1698 int32_t poly_num_coords = 0;
1699 for (
auto ring = 0; ring < poly_num_rings; ring++) {
1700 poly_num_coords += 2 * *next_poly_ring_sizes++;
1703 next_poly_coords += poly_coords_size;
1715 if (poly == 0 || min_distance > distance) {
1716 min_distance = distance;
1724 return min_distance;
1739 p, psize, l, lsize, lindex, ic2, isr2, ic1, isr1, osr);
1757 auto l1_num_points = l1_num_coords / 2;
1758 if (l1index < 0 || l1index > l1_num_points) {
1759 l1index = l1_num_points;
1764 p, psize, l2, l2size, l2index, ic1, isr1, ic2, isr2, osr);
1770 auto l2_num_points = l2_num_coords / 2;
1771 if (l2index < 0 || l2index > l2_num_points) {
1772 l2index = l2_num_points;
1777 p, psize, l1, l1size, l1index, ic2, isr2, ic1, isr1, osr);
1781 double l11x =
coord_x(l1, 0, ic1, isr1, osr);
1782 double l11y =
coord_y(l1, 1, ic1, isr1, osr);
1783 for (int32_t i1 = 2; i1 < l1_num_coords; i1 += 2) {
1784 double l12x =
coord_x(l1, i1, ic1, isr1, osr);
1785 double l12y =
coord_y(l1, i1 + 1, ic1, isr1, osr);
1787 double l21x =
coord_x(l2, 0, ic2, isr2, osr);
1788 double l21y =
coord_y(l2, 1, ic2, isr2, osr);
1789 for (int32_t i2 = 2; i2 < l2_num_coords; i2 += 2) {
1790 double l22x =
coord_x(l2, i2, ic2, isr2, osr);
1791 double l22y =
coord_y(l2, i2 + 1, ic2, isr2, osr);
1794 if (i1 == 2 && i2 == 2) {
1796 }
else if (dist > ldist) {
1817 int8_t* poly_coords,
1818 int64_t poly_coords_size,
1819 int32_t* poly_ring_sizes,
1820 int64_t poly_num_rings,
1827 auto lnum_points = lnum_coords / 2;
1828 if (lindex < 0 || lindex > lnum_points) {
1829 lindex = lnum_points;
1846 return min_distance;
1856 auto poly_ring_coords = poly_coords;
1857 for (
auto r = 0; r < poly_num_rings; r++) {
1858 int64_t poly_ring_num_coords = poly_ring_sizes[r] * 2;
1861 poly_ring_num_coords,
1869 if (min_distance > distance) {
1870 min_distance = distance;
1879 return min_distance;
1886 int8_t* mpoly_coords,
1887 int64_t mpoly_coords_size,
1888 int32_t* mpoly_ring_sizes,
1889 int64_t mpoly_num_rings,
1890 int32_t* mpoly_poly_sizes,
1891 int64_t mpoly_num_polys,
1900 auto lnum_points = lnum_coords / 2;
1903 if (lindex < 0 || lindex > lnum_points) {
1904 lindex = lnum_points;
1923 double min_distance = 0.0;
1926 auto next_poly_coords = mpoly_coords;
1927 auto next_poly_ring_sizes = mpoly_ring_sizes;
1929 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
1930 auto poly_coords = next_poly_coords;
1931 auto poly_ring_sizes = next_poly_ring_sizes;
1932 auto poly_num_rings = mpoly_poly_sizes[poly];
1934 int32_t poly_num_coords = 0;
1935 for (
auto ring = 0; ring < poly_num_rings; ring++) {
1936 poly_num_coords += 2 * *next_poly_ring_sizes++;
1939 next_poly_coords += poly_coords_size;
1952 if (poly == 0 || min_distance > distance) {
1953 min_distance = distance;
1961 return min_distance;
1966 int64_t poly_coords_size,
1967 int32_t* poly_ring_sizes,
1968 int64_t poly_num_rings,
1991 int64_t poly_coords_size,
1992 int32_t* poly_ring_sizes,
1993 int64_t poly_num_rings,
2018 int64_t poly1_coords_size,
2019 int32_t* poly1_ring_sizes,
2020 int64_t poly1_num_rings,
2021 int8_t* poly2_coords,
2022 int64_t poly2_coords_size,
2023 int32_t* poly2_ring_sizes,
2024 int64_t poly2_num_rings,
2031 auto poly2_first_point_coords = poly2_coords;
2037 poly2_first_point_coords,
2038 poly2_first_point_coords_size,
2059 auto poly1_ring_coords = poly1_coords;
2060 for (
auto r1 = 0; r1 < poly1_num_rings; r1++) {
2061 int64_t poly1_ring_num_coords = poly1_ring_sizes[r1] * 2;
2063 auto poly2_ring_coords = poly2_coords;
2064 for (
auto r2 = 0; r2 < poly2_num_rings; r2++) {
2065 int64_t poly2_ring_num_coords = poly2_ring_sizes[r2] * 2;
2068 poly1_ring_num_coords,
2070 poly2_ring_num_coords,
2076 if (min_distance > distance) {
2077 min_distance = distance;
2089 return min_distance;
2094 int64_t poly1_coords_size,
2095 int32_t* poly1_ring_sizes,
2096 int64_t poly1_num_rings,
2097 int8_t* mpoly_coords,
2098 int64_t mpoly_coords_size,
2099 int32_t* mpoly_ring_sizes,
2100 int64_t mpoly_num_rings,
2101 int32_t* mpoly_poly_sizes,
2102 int64_t mpoly_num_polys,
2108 double min_distance = 0.0;
2111 auto next_poly_coords = mpoly_coords;
2112 auto next_poly_ring_sizes = mpoly_ring_sizes;
2114 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
2115 auto poly_coords = next_poly_coords;
2116 auto poly_ring_sizes = next_poly_ring_sizes;
2117 auto poly_num_rings = mpoly_poly_sizes[poly];
2119 int32_t poly_num_coords = 0;
2120 for (
auto ring = 0; ring < poly_num_rings; ring++) {
2121 poly_num_coords += 2 * *next_poly_ring_sizes++;
2124 next_poly_coords += poly_coords_size;
2138 if (poly == 0 || min_distance > distance) {
2139 min_distance = distance;
2147 return min_distance;
2152 int64_t mpoly_coords_size,
2153 int32_t* mpoly_ring_sizes,
2154 int64_t mpoly_num_rings,
2155 int32_t* mpoly_poly_sizes,
2156 int64_t mpoly_num_polys,
2181 int64_t mpoly_coords_size,
2182 int32_t* mpoly_ring_sizes,
2183 int64_t mpoly_num_rings,
2184 int32_t* mpoly_poly_sizes,
2185 int64_t mpoly_num_polys,
2212 int64_t mpoly_coords_size,
2213 int32_t* mpoly_ring_sizes,
2214 int64_t mpoly_num_rings,
2215 int32_t* mpoly_poly_sizes,
2216 int64_t mpoly_num_polys,
2217 int8_t* poly1_coords,
2218 int64_t poly1_coords_size,
2219 int32_t* poly1_ring_sizes,
2220 int64_t poly1_num_rings,
2245 int64_t mpoly1_coords_size,
2246 int32_t* mpoly1_ring_sizes,
2247 int64_t mpoly1_num_rings,
2248 int32_t* mpoly1_poly_sizes,
2249 int64_t mpoly1_num_polys,
2250 int8_t* mpoly2_coords,
2251 int64_t mpoly2_coords_size,
2252 int32_t* mpoly2_ring_sizes,
2253 int64_t mpoly2_num_rings,
2254 int32_t* mpoly2_poly_sizes,
2255 int64_t mpoly2_num_polys,
2261 double min_distance = 0.0;
2265 auto next_poly_coords = mpoly1_coords;
2266 auto next_poly_ring_sizes = mpoly1_ring_sizes;
2268 for (
auto poly = 0; poly < mpoly1_num_polys; poly++) {
2269 auto poly_coords = next_poly_coords;
2270 auto poly_ring_sizes = next_poly_ring_sizes;
2271 auto poly_num_rings = mpoly1_poly_sizes[poly];
2273 int32_t poly_num_coords = 0;
2274 for (
auto ring = 0; ring < poly_num_rings; ring++) {
2275 poly_num_coords += 2 * *next_poly_ring_sizes++;
2278 next_poly_coords += poly_coords_size;
2294 if (poly == 0 || min_distance > distance) {
2295 min_distance = distance;
2303 return min_distance;
2320 if (length1 > length2) {
2336 bool check_closed) {
2337 double px =
coord_x(p, 0, ic1, isr1, osr);
2338 double py =
coord_y(p, 1, ic1, isr1, osr);
2341 auto l_num_points = l_num_coords / 2;
2343 if (lindex < 0 || lindex > l_num_points) {
2344 lindex = l_num_points;
2346 double lx =
coord_x(l, 2 * (lindex - 1), ic2, isr2, osr);
2347 double ly =
coord_y(l, 2 * (lindex - 1) + 1, ic2, isr2, osr);
2351 double l1x =
coord_x(l, 0, ic2, isr2, osr);
2352 double l1y =
coord_y(l, 1, ic2, isr2, osr);
2353 double l2x =
coord_x(l, 2, ic2, isr2, osr);
2354 double l2y =
coord_y(l, 3, ic2, isr2, osr);
2357 for (int32_t i = 4; i < l_num_coords; i += 2) {
2360 l2x =
coord_x(l, i, ic2, isr2, osr);
2361 l2y =
coord_y(l, i + 1, ic2, isr2, osr);
2363 if (max_dist < ldist) {
2367 if (l_num_coords > 4 && check_closed) {
2369 l1x =
coord_x(l, 0, ic2, isr2, osr);
2370 l1y =
coord_y(l, 1, ic2, isr2, osr);
2372 if (max_dist < ldist) {
2391 p, psize, l, lsize, lindex, ic1, isr1, ic2, isr2, osr,
false);
2406 p, psize, l, lsize, lindex, ic2, isr2, ic1, isr1, osr,
false);
2423 double p1x =
coord_x(p1, 0, ic1, isr1, osr);
2424 double p1y =
coord_y(p1, 1, ic1, isr1, osr);
2425 double p2x =
coord_x(p2, 0, ic2, isr2, osr);
2426 double p2y =
coord_y(p2, 1, ic2, isr2, osr);
2427 double tolerance =
tol(ic1, ic2);
2428 return tol_eq(p1x, p2x, tolerance) &&
tol_eq(p1y, p2y, tolerance);
2437 int64_t lbounds_size,
2444 double px =
coord_x(p, 0, ic1, isr1, osr);
2445 double py =
coord_y(p, 1, ic1, isr1, osr);
2449 tol_eq(py, lbounds[3])) {
2455 for (
int i = 0; i < l_num_coords; i += 2) {
2456 double lx =
coord_x(l, i, ic2, isr2, osr);
2457 double ly =
coord_y(l, i + 1, ic2, isr2, osr);
2469 int8_t* poly_coords,
2470 int64_t poly_coords_size,
2471 int32_t* poly_ring_sizes,
2472 int64_t poly_num_rings,
2473 double* poly_bounds,
2474 int64_t poly_bounds_size,
2481 if (poly_num_rings > 0) {
2482 exterior_ring_num_coords = poly_ring_sizes[0] * 2;
2489 exterior_ring_coords_size,
2504 int64_t lbounds_size,
2521 int64_t l1bounds_size,
2526 int64_t l2bounds_size,
2533 if (l1i != 0 || l2i != 0) {
2536 l1, l1size, l1i, l2, l2size, l2i, ic1, isr1, ic2, isr2, osr));
2550 int64_t lbounds_size,
2552 int8_t* poly_coords,
2553 int64_t poly_coords_size,
2554 int32_t* poly_ring_sizes,
2555 int64_t poly_num_rings,
2556 double* poly_bounds,
2557 int64_t poly_bounds_size,
2569 int64_t poly_coords_size,
2570 int32_t* poly_ring_sizes,
2571 int64_t poly_num_rings,
2572 double* poly_bounds,
2573 int64_t poly_bounds_size,
2581 double px =
coord_x(p, 0, ic2, isr2, osr);
2582 double py =
coord_y(p, 1, ic2, isr2, osr);
2591 auto exterior_ring_num_coords = poly_num_coords;
2592 if (poly_num_rings > 0) {
2593 exterior_ring_num_coords = poly_ring_sizes[0] * 2;
2596 auto poly = poly_coords;
2601 for (
auto r = 1; r < poly_num_rings; r++) {
2602 int64_t interior_ring_num_coords = poly_ring_sizes[r] * 2;
2604 poly, interior_ring_num_coords, px, py, ic1, isr1, osr)) {
2616 int64_t poly_coords_size,
2617 int32_t* poly_ring_sizes,
2618 int64_t poly_num_rings,
2619 double* poly_bounds,
2620 int64_t poly_bounds_size,
2624 int64_t lbounds_size,
2631 if (poly_num_rings > 1) {
2637 auto lnum_points = lnum_coords / 2;
2640 if (li < 0 || li > lnum_points) {
2643 double lx =
coord_x(l, 2 * (li - 1), ic2, isr2, osr);
2644 double ly =
coord_y(l, 2 * (li - 1) + 1, ic2, isr2, osr);
2655 if (poly_bounds && lbounds) {
2656 if (!
box_contains_box(poly_bounds, poly_bounds_size, lbounds, lbounds_size)) {
2662 poly_coords, poly_num_coords, l, lnum_coords, ic1, isr1, ic2, isr2, osr);
2667 int64_t poly1_coords_size,
2668 int32_t* poly1_ring_sizes,
2669 int64_t poly1_num_rings,
2670 double* poly1_bounds,
2671 int64_t poly1_bounds_size,
2672 int8_t* poly2_coords,
2673 int64_t poly2_coords_size,
2674 int32_t* poly2_ring_sizes,
2675 int64_t poly2_num_rings,
2676 double* poly2_bounds,
2677 int64_t poly2_bounds_size,
2685 if (poly1_num_rings > 1) {
2689 if (poly1_bounds && poly2_bounds) {
2691 poly1_bounds, poly1_bounds_size, poly2_bounds, poly2_bounds_size)) {
2696 int64_t poly2_exterior_ring_coords_size = poly2_coords_size;
2697 if (poly2_num_rings > 0) {
2698 poly2_exterior_ring_coords_size =
2708 poly2_exterior_ring_coords_size,
2721 int64_t mpoly_coords_size,
2722 int32_t* mpoly_ring_sizes,
2723 int64_t mpoly_num_rings,
2724 int32_t* mpoly_poly_sizes,
2725 int64_t mpoly_num_polys,
2726 double* mpoly_bounds,
2727 int64_t mpoly_bounds_size,
2735 if (mpoly_num_polys <= 0) {
2739 double px =
coord_x(p, 0, ic2, isr2, osr);
2740 double py =
coord_y(p, 1, ic2, isr2, osr);
2751 auto next_poly_coords = mpoly_coords;
2752 auto next_poly_ring_sizes = mpoly_ring_sizes;
2754 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
2755 auto poly_coords = next_poly_coords;
2756 auto poly_ring_sizes = next_poly_ring_sizes;
2757 auto poly_num_rings = mpoly_poly_sizes[poly];
2759 int32_t poly_num_coords = 0;
2760 for (
auto ring = 0; ring < poly_num_rings; ring++) {
2761 poly_num_coords += 2 * *next_poly_ring_sizes++;
2764 next_poly_coords += poly_coords_size;
2788 int64_t mpoly_coords_size,
2789 int32_t* mpoly_ring_sizes,
2790 int64_t mpoly_num_rings,
2791 int32_t* mpoly_poly_sizes,
2792 int64_t mpoly_num_polys,
2793 double* mpoly_bounds,
2794 int64_t mpoly_bounds_size,
2798 int64_t lbounds_size,
2805 if (mpoly_num_polys <= 0) {
2810 auto lnum_points = lnum_coords / 2;
2813 if (li < 0 || li > lnum_points) {
2816 double lx =
coord_x(l, 2 * (li - 1), ic2, isr2, osr);
2817 double ly =
coord_y(l, 2 * (li - 1) + 1, ic2, isr2, osr);
2843 if (mpoly_bounds && lbounds) {
2844 if (!
box_contains_box(mpoly_bounds, mpoly_bounds_size, lbounds, lbounds_size)) {
2850 auto next_poly_coords = mpoly_coords;
2851 auto next_poly_ring_sizes = mpoly_ring_sizes;
2853 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
2854 auto poly_coords = next_poly_coords;
2855 auto poly_ring_sizes = next_poly_ring_sizes;
2856 auto poly_num_rings = mpoly_poly_sizes[poly];
2858 int32_t poly_num_coords = 0;
2859 for (
auto ring = 0; ring < poly_num_rings; ring++) {
2860 poly_num_coords += 2 * *next_poly_ring_sizes++;
2863 next_poly_coords += poly_coords_size;
2912 int64_t lbounds_size,
2919 double px =
coord_x(p, 0, ic1, isr1, osr);
2920 double py =
coord_y(p, 1, ic1, isr1, osr);
2923 auto lnum_points = lnum_coords / 2;
2926 if (li < 0 || li > lnum_points) {
2949 int32_t* poly_ring_sizes,
2950 int64_t poly_num_rings,
2951 double* poly_bounds,
2952 int64_t poly_bounds_size,
2976 int8_t* mpoly_coords,
2977 int64_t mpoly_coords_size,
2978 int32_t* mpoly_ring_sizes,
2979 int64_t mpoly_num_rings,
2980 int32_t* mpoly_poly_sizes,
2981 int64_t mpoly_num_polys,
2982 double* mpoly_bounds,
2983 int64_t mpoly_bounds_size,
3010 int64_t lbounds_size,
3020 p, psize, l, lsize, lbounds, lbounds_size, li, ic2, isr2, ic1, isr1, osr);
3027 int64_t l1bounds_size,
3032 int64_t l2bounds_size,
3040 auto l2num_points = l2num_coords / 2;
3043 if (l2i < 0 || l2i > l2num_points) {
3049 l1, l1size, l1bounds, l1bounds_size, l1i, p2, p2size, ic1, isr1, ic2, isr2, osr);
3052 auto l1num_points = l1num_coords / 2;
3055 if (l1i < 0 || l1i > l1num_points) {
3061 l2, l2size, l2bounds, l2bounds_size, l2i, p1, p1size, ic2, isr2, ic1, isr1, osr);
3064 if (l1bounds && l2bounds) {
3071 l1, l1size, l1i, l2, l2size, l2i, ic1, isr1, ic2, isr2, osr));
3078 int64_t lbounds_size,
3082 int32_t* poly_ring_sizes,
3083 int64_t poly_num_rings,
3084 double* poly_bounds,
3085 int64_t poly_bounds_size,
3092 auto lnum_points = lnum_coords / 2;
3095 if (li < 0 || li > lnum_points) {
3115 if (lbounds && poly_bounds) {
3116 if (!
box_overlaps_box(lbounds, lbounds_size, poly_bounds, poly_bounds_size)) {
3146 int64_t lbounds_size,
3148 int8_t* mpoly_coords,
3149 int64_t mpoly_coords_size,
3150 int32_t* mpoly_ring_sizes,
3151 int64_t mpoly_num_rings,
3152 int32_t* mpoly_poly_sizes,
3153 int64_t mpoly_num_polys,
3154 double* mpoly_bounds,
3155 int64_t mpoly_bounds_size,
3162 auto lnum_points = lnum_coords / 2;
3165 if (li < 0 || li > lnum_points) {
3187 if (lbounds && mpoly_bounds) {
3188 if (!
box_overlaps_box(lbounds, lbounds_size, mpoly_bounds, mpoly_bounds_size)) {
3219 int32_t* poly_ring_sizes,
3220 int64_t poly_num_rings,
3221 double* poly_bounds,
3222 int64_t poly_bounds_size,
3248 int32_t* poly_ring_sizes,
3249 int64_t poly_num_rings,
3250 double* poly_bounds,
3251 int64_t poly_bounds_size,
3255 int64_t lbounds_size,
3282 int64_t poly1_coords_size,
3283 int32_t* poly1_ring_sizes,
3284 int64_t poly1_num_rings,
3285 double* poly1_bounds,
3286 int64_t poly1_bounds_size,
3287 int8_t* poly2_coords,
3288 int64_t poly2_coords_size,
3289 int32_t* poly2_ring_sizes,
3290 int64_t poly2_num_rings,
3291 double* poly2_bounds,
3292 int64_t poly2_bounds_size,
3298 if (poly1_bounds && poly2_bounds) {
3300 poly1_bounds, poly1_bounds_size, poly2_bounds, poly2_bounds_size)) {
3322 int64_t poly_coords_size,
3323 int32_t* poly_ring_sizes,
3324 int64_t poly_num_rings,
3325 double* poly_bounds,
3326 int64_t poly_bounds_size,
3327 int8_t* mpoly_coords,
3328 int64_t mpoly_coords_size,
3329 int32_t* mpoly_ring_sizes,
3330 int64_t mpoly_num_rings,
3331 int32_t* mpoly_poly_sizes,
3332 int64_t mpoly_num_polys,
3333 double* mpoly_bounds,
3334 int64_t mpoly_bounds_size,
3340 if (poly_bounds && mpoly_bounds) {
3342 poly_bounds, poly_bounds_size, mpoly_bounds, mpoly_bounds_size)) {
3366 int64_t mpoly_coords_size,
3367 int32_t* mpoly_ring_sizes,
3368 int64_t mpoly_num_rings,
3369 int32_t* mpoly_poly_sizes,
3370 int64_t mpoly_num_polys,
3371 double* mpoly_bounds,
3372 int64_t mpoly_bounds_size,
3399 int64_t mpoly_coords_size,
3400 int32_t* mpoly_ring_sizes,
3401 int64_t mpoly_num_rings,
3402 int32_t* mpoly_poly_sizes,
3403 int64_t mpoly_num_polys,
3404 double* mpoly_bounds,
3405 int64_t mpoly_bounds_size,
3409 int64_t lbounds_size,
3438 int64_t mpoly_coords_size,
3439 int32_t* mpoly_ring_sizes,
3440 int64_t mpoly_num_rings,
3441 int32_t* mpoly_poly_sizes,
3442 int64_t mpoly_num_polys,
3443 double* mpoly_bounds,
3444 int64_t mpoly_bounds_size,
3445 int8_t* poly_coords,
3446 int64_t poly_coords_size,
3447 int32_t* poly_ring_sizes,
3448 int64_t poly_num_rings,
3449 double* poly_bounds,
3450 int64_t poly_bounds_size,
3479 int64_t mpoly1_coords_size,
3480 int32_t* mpoly1_ring_sizes,
3481 int64_t mpoly1_num_rings,
3482 int32_t* mpoly1_poly_sizes,
3483 int64_t mpoly1_num_polys,
3484 double* mpoly1_bounds,
3485 int64_t mpoly1_bounds_size,
3486 int8_t* mpoly2_coords,
3487 int64_t mpoly2_coords_size,
3488 int32_t* mpoly2_ring_sizes,
3489 int64_t mpoly2_num_rings,
3490 int32_t* mpoly2_poly_sizes,
3491 int64_t mpoly2_num_polys,
3492 double* mpoly2_bounds,
3493 int64_t mpoly2_bounds_size,
3499 if (mpoly1_bounds && mpoly2_bounds) {
3501 mpoly1_bounds, mpoly1_bounds_size, mpoly2_bounds, mpoly2_bounds_size)) {
3535 return reinterpret_cast<int64_t
>(bounds);
3540 return render_group;
3556 const int64_t psize,
3560 const double min_lon,
3561 const double max_lon,
3562 const int32_t img_width,
3563 const double min_width) {
3564 const double const1 = 0.017453292519943295769236907684886;
3565 const double const2 = 6372797.560856;
3568 double t1 = sinf(meters / (2.0 * const2));
3569 double t2 = cosf(const1 * lat);
3570 const double newlon = lon - (2.0 * asinf(t1 / t2)) / const1;
3575 const double domain_diff = max_domain_x - min_domain_x;
3576 t1 = ((t1 - min_domain_x) / domain_diff) *
static_cast<double>(img_width);
3577 t2 = ((t2 - min_domain_x) / domain_diff) *
static_cast<double>(img_width);
3580 const double sz = fabs(t1 - t2);
3581 return (sz < min_width ? min_width : sz);
3587 const int64_t psize,
3591 const double min_lat,
3592 const double max_lat,
3593 const int32_t img_height,
3594 const double min_height) {
3595 const double const1 = 0.017453292519943295769236907684886;
3596 const double const2 = 6372797.560856;
3598 const double latdiff = meters / (const1 * const2);
3599 const double newlat =
3600 (lat < 0) ? lat + latdiff : lat - latdiff;
3603 const double min_domain_y =
transform_coord(min_lat, isr, osr,
false);
3604 const double max_domain_y =
transform_coord(max_lat, isr, osr,
false);
3605 const double domain_diff = max_domain_y - min_domain_y;
3606 t1 = ((t1 - min_domain_y) / domain_diff) *
static_cast<double>(img_height);
3607 t2 = ((t2 - min_domain_y) / domain_diff) *
static_cast<double>(img_height);
3610 const double sz = fabs(t1 - t2);
3611 return (sz < min_height ? min_height : sz);
3615 const int64_t psize,
3617 const double min_lon,
3618 const double max_lon,
3619 const double min_lat,
3620 const double max_lat) {
3623 return !(lon < min_lon || lon > max_lon || lat < min_lat || lat > max_lat);
3627 const int64_t psize,
3629 const double meters,
3630 const double min_lon,
3631 const double max_lon,
3632 const double min_lat,
3633 const double max_lat) {
3634 const double const1 = 0.017453292519943295769236907684886;
3635 const double const2 = 6372797.560856;
3638 const double latdiff = meters / (const1 * const2);
3639 const double t1 = sinf(meters / (2.0 * const2));
3640 const double t2 = cosf(const1 * lat);
3641 const double londiff = (2.0 * asinf(t1 / t2)) / const1;
3642 return !(lon + londiff < min_lon || lon - londiff > max_lon ||
3643 lat + latdiff < min_lat || lat - latdiff > max_lat);
EXTENSION_NOINLINE double ST_Distance_LineString_LineString_Geodesic(int8_t *l1, int64_t l1size, int32_t l1index, int8_t *l2, int64_t l2size, int32_t l2index, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double convert_meters_to_pixel_width(const double meters, int8_t *p, const int64_t psize, const int32_t ic, const int32_t isr, const int32_t osr, const double min_lon, const double max_lon, const int32_t img_width, const double min_width)
DEVICE double distance_ring_ring(int8_t *ring1, int32_t ring1_num_coords, int8_t *ring2, int32_t ring2_num_coords, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_Point_Polygon(int8_t *p, int64_t psize, int8_t *poly, int64_t polysize, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE double coord_x(int8_t *data, int32_t index, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE double coord_y(int8_t *data, int32_t index, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE double length_linestring(int8_t *l, int64_t lsize, int32_t ic, int32_t isr, int32_t osr, bool geodesic, bool check_closed)
DEVICE ALWAYS_INLINE double transform_coord(double coord, int32_t isr, int32_t osr, bool x)
EXTENSION_NOINLINE double ST_Distance_Point_Point(int8_t *p1, int64_t p1size, int8_t *p2, int64_t p2size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_X_Point(int8_t *p, int64_t psize, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE bool on_segment(double px, double py, double qx, double qy, double rx, double ry)
EXTENSION_NOINLINE double ST_Centroid_LineString(int8_t *coords, int64_t coords_sz, int32_t ic, int32_t isr, int32_t osr, bool ycoord)
EXTENSION_INLINE double ST_Distance_MultiPolygon_Polygon(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int8_t *poly1_coords, int64_t poly1_coords_size, int32_t *poly1_ring_sizes, int64_t poly1_num_rings, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_MultiPolygon_Polygon(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, double *mpoly_bounds, int64_t mpoly_bounds_size, int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE double area_polygon(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_INLINE double ST_Distance_Polygon_LineString(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, int8_t *l, int64_t lsize, int32_t li, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_Point_Point(int8_t *p1, int64_t p1size, int8_t *p2, int64_t p2size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Perimeter_Polygon(int8_t *poly, int64_t polysize, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_LineString_Polygon(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE int32_t OmniSci_Geo_PolyRenderGroup(int32_t render_group)
DEVICE ALWAYS_INLINE bool centroid_add_triangle(double x1, double y1, double x2, double y2, double x3, double y3, double sign, double *total_area2, double *cg3)
EXTENSION_NOINLINE double ST_XMax(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Point_MultiPolygon(int8_t *p, int64_t psize, int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_Polygon_Point(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool ST_Intersects_LineString_MultiPolygon(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, double *mpoly_bounds, int64_t mpoly_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool ST_Intersects_Polygon_Polygon(int8_t *poly1_coords, int64_t poly1_coords_size, int32_t *poly1_ring_sizes, int64_t poly1_num_rings, double *poly1_bounds, int64_t poly1_bounds_size, int8_t *poly2_coords, int64_t poly2_coords_size, int32_t *poly2_ring_sizes, int64_t poly2_num_rings, double *poly2_bounds, int64_t poly2_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool is_point_size_in_view(int8_t *p, const int64_t psize, const int32_t ic, const double meters, const double min_lon, const double max_lon, const double min_lat, const double max_lat)
DEVICE double distance_point_line(double px, double py, double l1x, double l1y, double l2x, double l2y)
EXTENSION_NOINLINE double ST_X_LineString(int8_t *l, int64_t lsize, int32_t lindex, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_INLINE double ST_YMin_Bounds(double *bounds, int64_t size, int32_t isr, int32_t osr)
EXTENSION_NOINLINE double ST_YMax(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE bool tol_eq(double x, double y, double tolerance=TOLERANCE_DEFAULT)
EXTENSION_INLINE double ST_XMin_Bounds(double *bounds, int64_t size, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE double perimeter_multipolygon(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr, bool geodesic)
DEVICE ALWAYS_INLINE double max_distance_point_linestring(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t lindex, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, bool check_closed)
DEVICE double decompress_lattitude_coord_geoint32(const int32_t compressed)
EXTENSION_NOINLINE double ST_Area_Polygon(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_MultiPolygon_LineString(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, double *mpoly_bounds, int64_t mpoly_bounds_size, int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE double area_triangle(double x1, double y1, double x2, double y2, double x3, double y3)
EXTENSION_NOINLINE double ST_Distance_MultiPolygon_MultiPolygon(int8_t *mpoly1_coords, int64_t mpoly1_coords_size, int32_t *mpoly1_ring_sizes, int64_t mpoly1_num_rings, int32_t *mpoly1_poly_sizes, int64_t mpoly1_num_polys, int8_t *mpoly2_coords, int64_t mpoly2_coords_size, int32_t *mpoly2_ring_sizes, int64_t mpoly2_num_rings, int32_t *mpoly2_poly_sizes, int64_t mpoly2_num_polys, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_XMin(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_Polygon_LineString(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_Polygon_Point(int8_t *poly, int64_t polysize, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Polygon_MultiPolygon(int8_t *poly1_coords, int64_t poly1_coords_size, int32_t *poly1_ring_sizes, int64_t poly1_num_rings, int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Point_Point_Squared(int8_t *p1, int64_t p1size, int8_t *p2, int64_t p2size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Point_LineString(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t lindex, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Y_Point(int8_t *p, int64_t psize, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE bool tol_le(double x, double y, double tolerance=TOLERANCE_DEFAULT)
EXTENSION_NOINLINE double ST_Perimeter_MultiPolygon_Geodesic(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE double convert_meters_to_pixel_height(const double meters, int8_t *p, const int64_t psize, const int32_t ic, const int32_t isr, const int32_t osr, const double min_lat, const double max_lat, const int32_t img_height, const double min_height)
#define TOLERANCE_GEOINT32
EXTENSION_NOINLINE double ST_Y_LineString(int8_t *l, int64_t lsize, int32_t lindex, int32_t ic, int32_t isr, int32_t osr)
DEVICE double max_distance_point_line(double px, double py, double l1x, double l1y, double l2x, double l2y)
EXTENSION_INLINE int32_t MapD_GeoPolyRenderGroup(int32_t render_group)
EXTENSION_NOINLINE bool Point_Overlaps_Box(double *bounds, int64_t bounds_size, double px, double py)
EXTENSION_INLINE int64_t OmniSci_Geo_PolyBoundsPtr(double *bounds, int64_t size)
DEVICE ALWAYS_INLINE int32_t compression_unit_size(int32_t ic)
EXTENSION_NOINLINE bool ST_Intersects_LineString_Linestring(int8_t *l1, int64_t l1size, double *l1bounds, int64_t l1bounds_size, int32_t l1i, int8_t *l2, int64_t l2size, double *l2bounds, int64_t l2bounds_size, int32_t l2i, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
#define EXTENSION_NOINLINE
EXTENSION_INLINE double ST_Distance_LineString_Point(int8_t *l, int64_t lsize, int32_t lindex, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_Polygon_LineString(int8_t *poly, int64_t polysize, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE int16_t orientation(double px, double py, double qx, double qy, double rx, double ry)
EXTENSION_NOINLINE double ST_Distance_Polygon_Polygon(int8_t *poly1_coords, int64_t poly1_coords_size, int32_t *poly1_ring_sizes, int64_t poly1_num_rings, int8_t *poly2_coords, int64_t poly2_coords_size, int32_t *poly2_ring_sizes, int64_t poly2_num_rings, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Centroid_MultiPolygon(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr, bool ycoord)
EXTENSION_NOINLINE double ST_YMin(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_LineString_Point(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE double area_ring(int8_t *ring, int64_t ringsize, int32_t ic, int32_t isr, int32_t osr)
DEVICE double distance_ring_linestring(int8_t *ring, int32_t ring_num_coords, int8_t *l, int32_t lnum_coords, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE double ST_Area_Polygon_Geodesic(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE bool ST_Intersects_LineString_Polygon(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int8_t *poly, int64_t polysize, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE double ST_Distance_MultiPolygon_LineString(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int8_t *l, int64_t lsize, int32_t lindex, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE bool box_overlaps_box(double *bounds1, int64_t bounds1_size, double *bounds2, int64_t bounds2_size)
EXTENSION_INLINE int64_t MapD_GeoPolyBoundsPtr(double *bounds, int64_t size)
EXTENSION_INLINE bool ST_Intersects_Point_MultiPolygon(int8_t *p, int64_t psize, int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, double *mpoly_bounds, int64_t mpoly_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE bool linestring_intersects_line(int8_t *l, int32_t lnum_coords, double l1x, double l1y, double l2x, double l2y, int32_t ic1, int32_t isr1, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_LineString_MultiPolygon(int8_t *l, int64_t lsize, int32_t lindex, int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Centroid_Polygon(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr, bool ycoord)
#define TOLERANCE_DEFAULT
EXTENSION_INLINE double ST_Distance_LineString_Point_Geodesic(int8_t *l, int64_t lsize, int32_t lindex, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE bool line_intersects_line(double l11x, double l11y, double l12x, double l12y, double l21x, double l21y, double l22x, double l22y)
EXTENSION_NOINLINE double ST_Area_MultiPolygon(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE bool ST_Intersects_Polygon_MultiPolygon(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, double *mpoly_bounds, int64_t mpoly_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE bool box_contains_point(double *bounds, int64_t bounds_size, double px, double py)
DEVICE bool polygon_contains_point(int8_t *poly, int32_t poly_num_coords, double px, double py, int32_t ic1, int32_t isr1, int32_t osr)
EXTENSION_NOINLINE bool is_point_in_view(int8_t *p, const int64_t psize, const int32_t ic, const double min_lon, const double max_lon, const double min_lat, const double max_lat)
EXTENSION_INLINE double ST_Distance_MultiPolygon_Point(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE bool ST_Contains_LineString_Point(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_LineString_LineString(int8_t *l1, int64_t l1size, double *l1bounds, int64_t l1bounds_size, int32_t l1i, int8_t *l2, int64_t l2size, double *l2bounds, int64_t l2bounds_size, int32_t l2i, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE bool tol_zero(double x, double tolerance=TOLERANCE_DEFAULT)
DEVICE ALWAYS_INLINE bool centroid_add_polygon(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr, double *total_area2, double *cg3, double *total_length, double *linestring_centroid_sum, int64_t *num_points, double *point_centroid_sum)
EXTENSION_NOINLINE double ST_Distance_Point_ClosedLineString(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t lindex, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Point_Polygon(int8_t *p, int64_t psize, int8_t *poly, int64_t polysize, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_Point_Polygon(int8_t *p, int64_t psize, int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, double *poly_bounds, int64_t poly_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Point_Point_Geodesic(int8_t *p1, int64_t p1size, int8_t *p2, int64_t p2size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_MaxDistance_Point_LineString(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t lindex, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Length_LineString(int8_t *coords, int64_t coords_sz, int32_t ic, int32_t isr, int32_t osr)
DEVICE double decompress_longitude_coord_geoint32(const int32_t compressed)
EXTENSION_NOINLINE double ST_Perimeter_MultiPolygon(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_Point_Point(int8_t *p1, int64_t p1size, int8_t *p2, int64_t p2size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE double ST_Distance_Polygon_Point(int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE bool centroid_add_segment(double x1, double y1, double x2, double y2, double *length, double *linestring_centroid_sum)
EXTENSION_INLINE double ST_Area_MultiPolygon_Geodesic(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_INLINE int32_t ST_NRings(int32_t *poly_ring_sizes, int64_t poly_num_rings)
DEVICE ALWAYS_INLINE bool centroid_add_linestring(int8_t *l, int64_t lsize, int32_t ic, int32_t isr, int32_t osr, bool closed, double *total_length, double *linestring_centroid_sum, int64_t *num_points, double *point_centroid_sum)
EXTENSION_NOINLINE double ST_Perimeter_Polygon_Geodesic(int8_t *poly, int64_t polysize, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE double distance_point_point_squared(double p1x, double p1y, double p2x, double p2y)
DEVICE bool linestring_intersects_linestring(int8_t *l, int32_t lnum_coords, double l1x, double l1y, double l2x, double l2y, int32_t ic1, int32_t isr1, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_MultiPolygon_MultiPolygon(int8_t *mpoly1_coords, int64_t mpoly1_coords_size, int32_t *mpoly1_ring_sizes, int64_t mpoly1_num_rings, int32_t *mpoly1_poly_sizes, int64_t mpoly1_num_polys, double *mpoly1_bounds, int64_t mpoly1_bounds_size, int8_t *mpoly2_coords, int64_t mpoly2_coords_size, int32_t *mpoly2_ring_sizes, int64_t mpoly2_num_rings, int32_t *mpoly2_poly_sizes, int64_t mpoly2_num_polys, double *mpoly2_bounds, int64_t mpoly2_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double distance_in_meters(const double fromlon, const double fromlat, const double tolon, const double tolat)
Computes the distance, in meters, between two WGS-84 positions.
EXTENSION_NOINLINE double ST_Length_LineString_Geodesic(int8_t *coords, int64_t coords_sz, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Point_LineString_Geodesic(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t lindex, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_Polygon_Polygon(int8_t *poly1_coords, int64_t poly1_coords_size, int32_t *poly1_ring_sizes, int64_t poly1_num_rings, double *poly1_bounds, int64_t poly1_bounds_size, int8_t *poly2_coords, int64_t poly2_coords_size, int32_t *poly2_ring_sizes, int64_t poly2_num_rings, double *poly2_bounds, int64_t poly2_bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE bool tol_ge(double x, double y, double tolerance=TOLERANCE_DEFAULT)
#define COMPRESSION_GEOINT32
EXTENSION_NOINLINE double ST_Distance_LineString_Polygon(int8_t *l, int64_t lsize, int32_t lindex, int8_t *poly_coords, int64_t poly_coords_size, int32_t *poly_ring_sizes, int64_t poly_num_rings, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_MaxDistance_LineString_Point(int8_t *l, int64_t lsize, int32_t lindex, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE double tol(int32_t ic)
DEVICE double distance_line_line(double l11x, double l11y, double l12x, double l12y, double l21x, double l21y, double l22x, double l22y)
DEVICE bool polygon_contains_linestring(int8_t *poly, int32_t poly_num_coords, int8_t *l, int64_t lnum_coords, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Centroid_Point(int8_t *p, int64_t psize, int32_t ic, int32_t isr, int32_t osr, bool ycoord)
EXTENSION_NOINLINE bool ST_Contains_MultiPolygon_Point(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, double *mpoly_bounds, int64_t mpoly_bounds_size, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_MultiPolygon_Point(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, double *mpoly_bounds, int64_t mpoly_bounds_size, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE bool ring_intersects_line(int8_t *ring, int32_t ring_num_coords, double l1x, double l1y, double l2x, double l2y, int32_t ic1, int32_t isr1, int32_t osr)
EXTENSION_INLINE bool ST_Intersects_MultiPolygon_LineString(int8_t *mpoly_coords, int64_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int64_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int64_t mpoly_num_polys, double *mpoly_bounds, int64_t mpoly_bounds_size, int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE int32_t ST_NPoints(int8_t *coords, int64_t coords_sz, int32_t ic)
EXTENSION_NOINLINE double ST_Distance_LineString_LineString(int8_t *l1, int64_t l1size, int32_t l1index, int8_t *l2, int64_t l2size, int32_t l2index, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double conv_4326_900913_y(const double y)
DEVICE ALWAYS_INLINE double decompress_coord(int8_t *data, int32_t index, int32_t ic, bool x)
EXTENSION_NOINLINE double conv_4326_900913_x(const double x)
DEVICE ALWAYS_INLINE bool box_contains_box_vertex(double *bounds1, int64_t bounds1_size, double *bounds2, int64_t bounds2_size)
DEVICE ALWAYS_INLINE bool box_contains_box(double *bounds1, int64_t bounds1_size, double *bounds2, int64_t bounds2_size)
EXTENSION_INLINE double ST_YMax_Bounds(double *bounds, int64_t size, int32_t isr, int32_t osr)
EXTENSION_INLINE double ST_XMax_Bounds(double *bounds, int64_t size, int32_t isr, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_Point_LineString(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE double distance_point_linestring(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t lindex, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, bool check_closed)
EXTENSION_NOINLINE bool ST_Intersects_Point_LineString(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int32_t li, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE double distance_point_point(double p1x, double p1y, double p2x, double p2y)
DEVICE ALWAYS_INLINE bool centroid_add_ring(int8_t *ring, int64_t ringsize, int32_t ic, int32_t isr, int32_t osr, double sign, double *total_area2, double *cg3, double *total_length, double *linestring_centroid_sum, int64_t *num_points, double *point_centroid_sum)