16 #pragma clang diagnostic push
17 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
44 return fmax(
tol(ic1),
tol(ic2));
49 return (-tolerance <= x) && (x <= tolerance);
56 return (-tolerance <= diff) && (diff <= tolerance);
62 return x <= (y + tolerance);
68 return (x + tolerance) >= y;
80 double x{std::numeric_limits<double>::quiet_NaN()};
81 double y{std::numeric_limits<double>::quiet_NaN()};
88 const int32_t x_index,
91 const int32_t adjusted_index = x_index + (C ==
Coords::Y);
93 auto compressed_coords =
reinterpret_cast<const int32_t*
>(data);
101 auto double_coords =
reinterpret_cast<const double*
>(data);
102 return double_coords[adjusted_index];
115 if constexpr (static_cast<bool>(C &
Coords::X)) {
118 if constexpr (static_cast<bool>(C &
Coords::Y)) {
128 if constexpr (static_cast<bool>(C &
Coords::X)) {
131 if constexpr (static_cast<bool>(C &
Coords::Y)) {
141 if constexpr (static_cast<bool>(C &
Coords::X)) {
144 if constexpr (static_cast<bool>(C &
Coords::Y)) {
158 if (isr == osr || osr == 0) {
160 }
else if (isr == 4326) {
162 return conv_4326_900913<C>(point);
163 #ifdef ENABLE_UTM_TRANSFORM
165 return conv_4326_utm<C>(point, osr);
169 return conv_utm_4326<C>(point, osr);
176 throw std::runtime_error(
"Unhandled geo transformation from " +
std::to_string(isr) +
183 #ifdef ENABLE_UTM_TRANSFORM
193 const int32_t x_index,
197 Point2D
const decompressed{decompress_coord<X>(data, x_index, ic),
198 decompress_coord<Y>(data, x_index, ic)};
199 return transform_point<XY>(decompressed, isr, osr);
206 const int32_t x_index,
210 Point2D decompressed;
213 decompressed = {decompress_coord<X>(data, x_index, ic),
214 decompress_coord<Y>(data, x_index, ic)};
217 decompressed.x = decompress_coord<X>(data, x_index, ic);
219 decompressed.y = decompress_coord<Y>(data, x_index, ic);
222 return transform_point<C>(decompressed, isr, osr);
227 const auto compressed_coords =
reinterpret_cast<const int32_t*
>(data);
228 return compressed_coords[index];
275 double dotprod = (px - l1x) * (l2x - l1x) + (py - l1y) * (l2y - l1y);
276 double k = dotprod / (length * length);
277 k = fmax(0.0, fmin(1.0, k));
278 double projx = l1x + k * (l2x - l1x);
279 double projy = l1y + k * (l2y - l1y);
302 double dotprod = (px - l1x) * (l2x - l1x) + (py - l1y) * (l2y - l1y);
303 double k = dotprod / (length * length);
304 k = fmax(0.0, fmin(1.0, k));
305 double projx = l1x + k * (l2x - l1x);
306 double projy = l1y + k * (l2y - l1y);
318 return (
tol_le(qx, fmax(px, rx)) &&
tol_ge(qx, fmin(px, rx)) &&
323 orientation(
double px,
double py,
double qx,
double qy,
double rx,
double ry) {
324 auto val = ((qy - py) * (rx - qx) - (qx - px) * (ry - qy));
344 auto o1 =
orientation(l11x, l11y, l12x, l12y, l21x, l21y);
345 auto o2 =
orientation(l11x, l11y, l12x, l12y, l22x, l22y);
346 auto o3 =
orientation(l21x, l21y, l22x, l22y, l11x, l11y);
347 auto o4 =
orientation(l21x, l21y, l22x, l22y, l12x, l12y);
350 if (o1 != o2 && o3 != o4) {
356 if (o1 == 0 &&
on_segment(l11x, l11y, l21x, l21y, l12x, l12y)) {
361 if (o2 == 0 &&
on_segment(l11x, l11y, l22x, l22y, l12x, l12y)) {
366 if (o3 == 0 &&
on_segment(l21x, l21y, l11x, l11y, l22x, l22y)) {
371 if (o4 == 0 &&
on_segment(l21x, l21y, l12x, l12y, l22x, l22y)) {
388 Point2D e1 =
get_point(l, 0, ic1, isr1, osr);
389 for (int64_t i = 2; i < lnum_coords; i += 2) {
390 Point2D e2 =
get_point(l, i, ic1, isr1, osr);
401 int32_t ring_num_coords,
409 Point2D e1 =
get_point(ring, ring_num_coords - 2, ic1, isr1, osr);
410 Point2D e2 =
get_point(ring, 0, ic1, isr1, osr);
415 ring, ring_num_coords, l1x, l1y, l2x, l2y, ic1, isr1, osr);
428 Point2D e1 =
get_point(l, 0, ic1, isr1, osr);
429 for (int64_t i = 2; i < lnum_coords; i += 2) {
430 Point2D e2 =
get_point(l, i, ic1, isr1, osr);
456 return fmin(dist12, dist21);
476 return fmin(dist12, dist21);
481 int32_t ring_num_coords,
490 double min_distance = 0.0;
492 Point2D re1 =
get_point(ring, ring_num_coords - 2, ic1, isr1, osr);
493 for (
auto i = 0; i < ring_num_coords; i += 2) {
494 Point2D re2 =
get_point(ring, i, ic1, isr1, osr);
495 Point2D le1 =
get_point(l, 0, ic2, isr2, osr);
496 for (
auto j = 2; j < lnum_coords; j += 2) {
497 Point2D le2 =
get_point(l, j, ic2, isr2, osr);
500 if ((i == 0 && j == 2) || min_distance > distance) {
501 min_distance = distance;
505 if (min_distance <= threshold) {
518 int32_t ring1_num_coords,
520 int32_t ring2_num_coords,
527 double min_distance = 0.0;
528 Point2D e11 =
get_point(ring1, ring1_num_coords - 2, ic1, isr1, osr);
529 for (
auto i = 0; i < ring1_num_coords; i += 2) {
530 Point2D e12 =
get_point(ring1, i, ic1, isr1, osr);
531 Point2D e21 =
get_point(ring2, ring2_num_coords - 2, ic2, isr2, osr);
532 for (
auto j = 0; j < ring2_num_coords; j += 2) {
533 Point2D e22 =
get_point(ring2, j, ic2, isr2, osr);
536 if ((i == 0 && j == 0) || min_distance > distance) {
537 min_distance = distance;
541 if (min_distance <= threshold) {
556 template <
typename T>
558 is_left(
const T lx0,
const T ly0,
const T lx1,
const T ly1,
const T px,
const T py) {
559 return ((lx1 - lx0) * (py - ly0) - (px - lx0) * (ly1 - ly0));
562 template <
typename T>
565 if constexpr (!std::is_floating_point<T>::value) {
568 return (-tolerance <= x) && (x <= tolerance);
586 template <
typename T, EdgeBehavior TEdgeBehavior>
588 const int32_t poly_num_coords,
596 constexpr
bool include_point_on_edge =
599 auto get_x_coord = [=](
const auto data,
const auto index) ->
T {
600 if constexpr (std::is_floating_point<T>::value) {
601 return get_point(data, index, ic1, isr1, osr).x;
608 auto get_y_coord = [=](
const auto data,
const auto index) ->
T {
609 if constexpr (std::is_floating_point<T>::value) {
610 return get_point(data, index, ic1, isr1, osr).y;
617 DEBUG_STMT(printf(
"Poly num coords: %d\n", poly_num_coords));
618 const int64_t num_edges = poly_num_coords / 2;
620 int64_t e0_index = 0;
621 T e0x = get_x_coord(poly, e0_index * 2);
622 T e0y = get_y_coord(poly, e0_index * 2);
627 for (int64_t edge = 1; edge <= num_edges; edge++) {
630 e1_index = edge % num_edges;
631 e1x = get_x_coord(poly, e1_index * 2);
632 e1y = get_y_coord(poly, e1_index * 2);
634 DEBUG_STMT(printf(
"edge 0: %ld : %f, %f\n", e0_index, (
double)e0x, (
double)e0y));
635 DEBUG_STMT(printf(
"edge 1: %ld : %f, %f\n", e1_index, (
double)e1x, (
double)e1y));
637 auto get_epsilon = [=]() ->
T {
638 if constexpr (std::is_floating_point<T>::value) {
639 const T edge_vec_magnitude =
640 (e1x - e0x) * (e1x - e0x) + (e1y - e0y) * (e1y - e0y);
641 return 0.003 * edge_vec_magnitude;
648 const T epsilon = get_epsilon();
649 DEBUG_STMT(printf(
"using epsilon value %e\n", (
double)epsilon));
651 if constexpr (include_point_on_edge) {
652 const T xp = (px - e1x) * (e0y - e1y) - (py - e1y) * (e0x - e1x);
653 const T pt_vec_magnitude = (px - e0x) * (px - e0x) + (py - e0y) * (py - e0y);
654 const T edge_vec_magnitude = (e1x - e0x) * (e1x - e0x) + (e1y - e0y) * (e1y - e0y);
655 if (
tol_zero_template(xp, epsilon) && (pt_vec_magnitude <= edge_vec_magnitude)) {
656 DEBUG_STMT(printf(
"point is on edge: %e && %e <= %e\n",
658 (
double)pt_vec_magnitude,
659 (
double)edge_vec_magnitude));
660 return include_point_on_edge;
668 const auto is_left_val =
is_left(e0x, e0y, e1x, e1y, px, py);
669 DEBUG_STMT(printf(
"Left val %f and tol zero left val %d\n",
674 return include_point_on_edge;
675 }
else if (is_left_val >
T(0)) {
681 }
else if (e1y <= py) {
684 const auto is_left_val =
is_left(e0x, e0y, e1x, e1y, px, py);
685 DEBUG_STMT(printf(
"Left val %f and tol zero left val %d\n",
690 return include_point_on_edge;
691 }
else if (is_left_val <
T(0)) {
722 const int32_t poly_num_coords,
730 bool horizontal_edge =
false;
731 bool yray_intersects =
false;
733 Point2D e1 =
get_point(poly, poly_num_coords - 2, ic1, isr1, osr);
734 for (int64_t i = 0; i < poly_num_coords; i += 2) {
735 Point2D e2 =
get_point(poly, i, ic1, isr1, osr);
749 horizontal_edge = (xray_touch != 0) &&
tol_eq(py, e1.y) &&
tol_eq(py, e2.y);
753 double xray = fmax(e2.x, e1.x) + 1.0;
768 if (xray_touch == 0) {
775 xray_touch = (e1.y > py) ? 1 : -1;
780 if (xray_touch > 0) {
806 if (!yray_intersects) {
807 double yray = fmin(e2.y, e1.y) - 1.0;
823 if (!yray_intersects) {
834 int32_t poly_num_coords,
843 Point2D l1 =
get_point(l, 0, ic2, isr2, osr);
850 for (int32_t i = 2; i < lnum_coords; i += 2) {
851 Point2D l2 =
get_point(l, i, ic2, isr2, osr);
853 poly, poly_num_coords, l1.x, l1.y, l2.x, l2.y, ic1, isr1, osr)) {
862 const int64_t bounds_size,
879 int64_t bounds1_size,
881 int64_t bounds2_size) {
885 bounds1, bounds1_size, bounds2[0], bounds2[1]) &&
887 bounds1, bounds1_size, bounds2[2], bounds2[3]));
891 int64_t bounds1_size,
893 int64_t bounds2_size) {
897 bounds1, bounds1_size, bounds2[0], bounds2[1]) ||
899 bounds1, bounds1_size, bounds2[2], bounds2[3]) ||
901 bounds1, bounds1_size, bounds2[0], bounds2[3]) ||
903 bounds1, bounds1_size, bounds2[2], bounds2[1]));
907 int64_t bounds1_size,
909 int64_t bounds2_size) {
912 if (bounds1[2] < bounds2[0] ||
913 bounds1[0] > bounds2[2] ||
914 bounds1[3] < bounds2[1] ||
915 bounds1[1] > bounds2[3]) {
926 int64_t bounds2_size,
934 Point2D p =
get_point(p1, 0, ic1, isr1, osr);
935 Point2D
const lb = transform_point<XY>({bounds2[0], bounds2[1]}, isr2, osr);
936 Point2D
const rt = transform_point<XY>({bounds2[2], bounds2[3]}, isr2, osr);
937 if (p.x < lb.x - distance ||
938 p.x > rt.x + distance ||
939 p.y < lb.y - distance ||
940 p.y > rt.y + distance) {
947 int64_t bounds1_size,
950 int64_t bounds2_size,
964 Point2D
const lb1 = transform_point<XY>({bounds1[0], bounds1[1]}, isr1, osr);
965 Point2D
const rt1 = transform_point<XY>({bounds1[2], bounds1[3]}, isr1, osr);
966 Point2D
const lb2 = transform_point<XY>({bounds2[0], bounds2[1]}, isr2, osr);
967 Point2D
const rt2 = transform_point<XY>({bounds2[2], bounds2[3]}, isr2, osr);
970 rt1.x + distance < lb2.x ||
972 lb1.x - distance > rt2.x ||
974 rt1.y + distance < lb2.y ||
976 lb1.y - distance > rt2.y) {
987 int64_t bounds2_size,
999 Point2D
const lb = transform_point<XY>({bounds2[0], bounds2[1]}, isr2, osr);
1000 Point2D
const rt = transform_point<XY>({bounds2[2], bounds2[3]}, isr2, osr);
1001 CoordData l1_relevant_section;
1006 Point2D l11 =
get_point(l1, 0, ic1, isr1, osr);
1007 for (int32_t i1 = 2; i1 < l1_num_coords; i1 += 2) {
1008 Point2D l12 =
get_point(l1, i1, ic1, isr1, osr);
1012 fmax(l11.x, l12.x) + distance < lb.x ||
1014 fmin(l11.x, l12.x) - distance > rt.x ||
1016 fmax(l11.y, l12.y) + distance < lb.y ||
1018 fmin(l11.y, l12.y) - distance > rt.y) {
1020 if (l1_relevant_section.ptr && l1_relevant_section.size == 0) {
1022 l1_relevant_section.size =
1027 if (!l1_relevant_section.ptr) {
1033 l1_relevant_section.size = 0;
1039 if (l1_relevant_section.ptr && l1_relevant_section.size == 0) {
1043 l1_relevant_section.size = l1size - (l1_relevant_section.ptr - l1);
1045 if (l1_relevant_section.ptr &&
1048 l1_relevant_section = {l1, l1size};
1051 return l1_relevant_section;
1055 double ST_X_Point(int8_t* p, int64_t psize, int32_t ic, int32_t isr, int32_t osr) {
1056 return coord<X>(p, 0, ic, isr, osr).x;
1060 double ST_Y_Point(int8_t* p, int64_t psize, int32_t ic, int32_t isr, int32_t osr) {
1061 return coord<Y>(p, 0, ic, isr, osr).y;
1065 double ST_XMin(int8_t* coords, int64_t size, int32_t ic, int32_t isr, int32_t osr) {
1068 for (int32_t i = 0; i < num_coords; i += 2) {
1069 double x = coord<X>(coords, i, ic, isr, osr).x;
1070 if (i == 0 || x < xmin) {
1078 double ST_YMin(int8_t* coords, int64_t size, int32_t ic, int32_t isr, int32_t osr) {
1081 for (int32_t i = 0; i < num_coords; i += 2) {
1082 double y = coord<Y>(coords, i, ic, isr, osr).y;
1083 if (i == 0 || y < ymin) {
1091 double ST_XMax(int8_t* coords, int64_t size, int32_t ic, int32_t isr, int32_t osr) {
1094 for (int32_t i = 0; i < num_coords; i += 2) {
1095 double x = coord<X>(coords, i, ic, isr, osr).x;
1096 if (i == 0 || x > xmax) {
1104 double ST_YMax(int8_t* coords, int64_t size, int32_t ic, int32_t isr, int32_t osr) {
1107 for (int32_t i = 0; i < num_coords; i += 2) {
1108 double y = coord<Y>(coords, i, ic, isr, osr).y;
1109 if (i == 0 || y > ymax) {
1118 return transform_point<X>({bounds[0], bounds[1]}, isr, osr).x;
1123 return transform_point<Y>({bounds[0], bounds[1]}, isr, osr).y;
1128 return transform_point<X>({bounds[2], bounds[3]}, isr, osr).x;
1133 return transform_point<Y>({bounds[2], bounds[3]}, isr, osr).y;
1146 bool check_closed) {
1149 double length = 0.0;
1151 Point2D l0 =
get_point(l, 0, ic, isr, osr);
1153 for (int32_t i = 2; i < l_num_coords; i += 2) {
1189 int8_t* linestring_sizes_in,
1190 int64_t linestring_sizes_sz,
1194 if (linestring_sizes_sz <= 0) {
1197 double mls_length = 0.0;
1199 auto next_linestring_coords = coords;
1201 for (
auto l = 0; l < linestring_sizes_sz; l++) {
1202 auto linestring_coords = next_linestring_coords;
1203 auto linestring_sizes =
reinterpret_cast<int32_t*
>(linestring_sizes_in);
1204 auto linestring_num_points = linestring_sizes[l];
1205 auto linestring_num_coords = 2 * linestring_num_points;
1207 next_linestring_coords += linestring_coords_size;
1209 linestring_coords, linestring_coords_size, ic, isr, osr,
false,
false);
1210 mls_length += ls_length;
1223 int8_t* poly_ring_sizes,
1224 int32_t poly_num_rings,
1228 if (poly_num_rings <= 0) {
1232 auto exterior_ring_num_coords = poly_ring_sizes[0] * 2;
1235 return length_linestring(poly, exterior_ring_coords_size, ic, isr, osr,
false,
true);
1241 int8_t* poly_ring_sizes_in,
1242 int32_t poly_num_rings,
1246 if (poly_num_rings <= 0) {
1250 auto poly_ring_sizes =
reinterpret_cast<int32_t*
>(poly_ring_sizes_in);
1251 auto exterior_ring_num_coords = poly_ring_sizes[0] * 2;
1254 return length_linestring(poly, exterior_ring_coords_size, ic, isr, osr,
true,
true);
1258 int32_t mpoly_coords_size,
1259 int8_t* mpoly_ring_sizes_in,
1260 int32_t mpoly_num_rings,
1261 int8_t* mpoly_poly_sizes,
1262 int32_t mpoly_num_polys,
1267 if (mpoly_num_polys <= 0 || mpoly_num_rings <= 0) {
1271 double perimeter = 0.0;
1273 auto mpoly_ring_sizes =
reinterpret_cast<int32_t*
>(mpoly_ring_sizes_in);
1276 auto next_poly_coords = mpoly_coords;
1277 auto next_poly_ring_sizes = mpoly_ring_sizes;
1279 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
1280 auto poly_coords = next_poly_coords;
1281 auto poly_ring_sizes = next_poly_ring_sizes;
1282 auto poly_num_rings =
reinterpret_cast<int32_t*
>(mpoly_poly_sizes)[poly];
1284 int32_t poly_num_coords = 0;
1285 for (
auto ring = 0; ring < poly_num_rings; ring++) {
1286 poly_num_coords += 2 * *next_poly_ring_sizes++;
1289 next_poly_coords += poly_coords_size;
1291 auto exterior_ring_num_coords = poly_ring_sizes[0] * 2;
1295 poly_coords, exterior_ring_coords_size, ic, isr, osr, geodesic,
true);
1303 int32_t mpoly_coords_size,
1304 int8_t* mpoly_ring_sizes,
1305 int32_t mpoly_num_rings,
1306 int8_t* mpoly_poly_sizes,
1307 int32_t mpoly_num_polys,
1325 int32_t mpoly_coords_size,
1326 int8_t* mpoly_ring_sizes,
1327 int32_t mpoly_num_rings,
1328 int8_t* mpoly_poly_sizes,
1329 int32_t mpoly_num_polys,
1355 return (x1 * y2 - x2 * y1 + x3 * y1 - x1 * y3 + x2 * y3 - x3 * y2) / 2.0;
1365 if (ring_num_coords < 6) {
1371 Point2D p1 =
get_point(ring, 0, ic, isr, osr);
1372 Point2D p2 =
get_point(ring, 2, ic, isr, osr);
1373 for (int32_t i = 4; i < ring_num_coords; i += 2) {
1374 Point2D p3 =
get_point(ring, i, ic, isr, osr);
1382 int32_t poly_coords_size,
1383 int8_t* poly_ring_sizes_in,
1384 int32_t poly_num_rings,
1388 if (poly_num_rings <= 0) {
1393 auto ring_coords = poly_coords;
1394 auto poly_ring_sizes =
reinterpret_cast<int32_t*
>(poly_ring_sizes_in);
1399 for (
auto r = 0; r < poly_num_rings; r++) {
1401 area +=
area_ring(ring_coords, ring_coords_size, ic, isr, osr);
1403 ring_coords += ring_coords_size;
1410 int32_t poly_coords_size,
1411 int8_t* poly_ring_sizes,
1412 int32_t poly_num_rings,
1417 poly_coords, poly_coords_size, poly_ring_sizes, poly_num_rings, ic, isr, osr);
1422 int32_t mpoly_coords_size,
1423 int8_t* mpoly_ring_sizes,
1424 int32_t mpoly_num_rings,
1425 int8_t* mpoly_poly_sizes_in,
1426 int32_t mpoly_num_polys,
1430 if (mpoly_num_rings <= 0 || mpoly_num_polys <= 0) {
1436 auto mpoly_poly_sizes =
reinterpret_cast<int32_t*
>(mpoly_poly_sizes_in);
1439 auto next_poly_coords = mpoly_coords;
1440 auto next_poly_ring_sizes =
reinterpret_cast<int32_t*
>(mpoly_ring_sizes);
1442 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
1443 auto poly_coords = next_poly_coords;
1444 auto poly_ring_sizes = next_poly_ring_sizes;
1445 auto poly_num_rings = mpoly_poly_sizes[poly];
1447 int32_t poly_num_coords = 0;
1448 for (
auto ring = 0; ring < poly_num_rings; ring++) {
1449 poly_num_coords += 2 * *next_poly_ring_sizes++;
1452 next_poly_coords += poly_coords_size;
1456 reinterpret_cast<int8_t*>(poly_ring_sizes),
1486 double* point_centroid) {
1487 Point2D
const centroid =
get_point(p, 0, ic, isr, osr);
1488 point_centroid[0] = centroid.x;
1489 point_centroid[1] = centroid.y;
1498 double* multipoint_centroid) {
1502 for (int32_t i = 0; i < mp_num_coords; i += 2) {
1503 Point2D mpp =
get_point(mp, i, ic, isr, osr);
1507 auto mp_num_points = mp_num_coords >> 1;
1508 multipoint_centroid[0] = x / mp_num_points;
1509 multipoint_centroid[1] = y / mp_num_points;
1517 double* linestring_centroid_sum) {
1520 double segment_midpoint_x = (x1 + x2) / 2.0;
1521 double segment_midpoint_y = (y1 + y2) / 2.0;
1522 linestring_centroid_sum[0] += ldist * segment_midpoint_x;
1523 linestring_centroid_sum[1] += ldist * segment_midpoint_y;
1533 double* total_length,
1534 double* linestring_centroid_sum,
1535 int64_t* num_points,
1536 double* point_centroid_sum) {
1538 double length = 0.0;
1539 Point2D
const l0 =
get_point(l, 0, ic, isr, osr);
1541 for (int32_t i = 2; i < l_num_coords; i += 2) {
1542 Point2D
const l1 = l2;
1546 if (l_num_coords > 4 && closed) {
1550 *total_length += length;
1551 if (length == 0.0 && l_num_coords > 0) {
1553 point_centroid_sum[0] += l0.x;
1554 point_centroid_sum[1] += l0.y;
1565 double* linestring_centroid) {
1566 double length = 0.0;
1567 double linestring_centroid_sum[2] = {0.0, 0.0};
1568 int64_t num_points = 0;
1569 double point_centroid_sum[2] = {0.0, 0.0};
1577 &linestring_centroid_sum[0],
1579 &point_centroid_sum[0]);
1581 linestring_centroid[0] = linestring_centroid_sum[0] / length;
1582 linestring_centroid[1] = linestring_centroid_sum[1] / length;
1583 }
else if (num_points > 0) {
1584 linestring_centroid[0] = point_centroid_sum[0] / num_points;
1585 linestring_centroid[1] = point_centroid_sum[1] / num_points;
1596 double* total_area2,
1598 double cx = x1 + x2 + x3;
1599 double cy = y1 + y2 + y3;
1600 double area2 = x1 * y2 - x2 * y1 + x3 * y1 - x1 * y3 + x2 * y3 - x3 * y2;
1601 cg3[0] += sign * area2 * cx;
1602 cg3[1] += sign * area2 * cy;
1603 *total_area2 += sign * area2;
1613 double* total_area2,
1615 double* total_length,
1616 double* linestring_centroid_sum,
1617 int64_t* num_points,
1618 double* point_centroid_sum) {
1621 if (ring_num_coords < 6) {
1625 Point2D p1 =
get_point(ring, 0, ic, isr, osr);
1626 Point2D p2 =
get_point(ring, 2, ic, isr, osr);
1627 for (int32_t i = 4; i < ring_num_coords; i += 2) {
1628 Point2D p3 =
get_point(ring, i, ic, isr, osr);
1640 linestring_centroid_sum,
1642 point_centroid_sum);
1647 int64_t poly_coords_size,
1648 int32_t* poly_ring_sizes,
1649 int64_t poly_num_rings,
1653 double* total_area2,
1655 double* total_length,
1656 double* linestring_centroid_sum,
1657 int64_t* num_points,
1658 double* point_centroid_sum) {
1659 if (poly_num_rings <= 0) {
1663 auto ring_coords = poly_coords;
1665 for (
auto r = 0; r < poly_num_rings; r++) {
1668 double sign = (r == 0) ? 1.0 : -1.0;
1678 linestring_centroid_sum,
1680 point_centroid_sum);
1682 ring_coords += ring_coords_size;
1689 int32_t poly_coords_size,
1690 int32_t* poly_ring_sizes,
1691 int32_t poly_num_rings,
1695 double* poly_centroid) {
1696 if (poly_num_rings <= 0) {
1697 poly_centroid[0] = 0.0;
1698 poly_centroid[1] = 0.0;
1700 double total_area2 = 0.0;
1701 double cg3[2] = {0.0, 0.0};
1702 double total_length = 0.0;
1703 double linestring_centroid_sum[2] = {0.0, 0.0};
1704 int64_t num_points = 0;
1705 double point_centroid_sum[2] = {0.0, 0.0};
1716 &linestring_centroid_sum[0],
1718 &point_centroid_sum[0]);
1720 if (total_area2 != 0.0) {
1721 poly_centroid[0] = cg3[0] / 3 / total_area2;
1722 poly_centroid[1] = cg3[1] / 3 / total_area2;
1723 }
else if (total_length > 0.0) {
1725 poly_centroid[0] = linestring_centroid_sum[0] / total_length;
1726 poly_centroid[1] = linestring_centroid_sum[1] / total_length;
1727 }
else if (num_points > 0) {
1729 poly_centroid[0] = point_centroid_sum[0] / num_points;
1730 poly_centroid[1] = point_centroid_sum[1] / num_points;
1732 Point2D centroid =
get_point(poly_coords, 0, ic, isr, osr);
1733 poly_centroid[0] = centroid.x;
1734 poly_centroid[1] = centroid.y;
1740 int32_t mpoly_coords_size,
1741 int32_t* mpoly_ring_sizes,
1742 int32_t mpoly_num_rings,
1743 int32_t* mpoly_poly_sizes,
1744 int32_t mpoly_num_polys,
1748 double* mpoly_centroid) {
1749 if (mpoly_num_rings <= 0 || mpoly_num_polys <= 0) {
1750 mpoly_centroid[0] = 0.0;
1751 mpoly_centroid[1] = 0.0;
1754 double total_area2 = 0.0;
1755 double cg3[2] = {0.0, 0.0};
1756 double total_length = 0.0;
1757 double linestring_centroid_sum[2] = {0.0, 0.0};
1758 int64_t num_points = 0;
1759 double point_centroid_sum[2] = {0.0, 0.0};
1762 auto next_poly_coords = mpoly_coords;
1763 auto next_poly_ring_sizes = mpoly_ring_sizes;
1765 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
1766 auto poly_coords = next_poly_coords;
1767 auto poly_ring_sizes = next_poly_ring_sizes;
1768 auto poly_num_rings = mpoly_poly_sizes[poly];
1770 int32_t poly_num_coords = 0;
1771 for (
auto ring = 0; ring < poly_num_rings; ring++) {
1772 poly_num_coords += 2 * *next_poly_ring_sizes++;
1775 next_poly_coords += poly_coords_size;
1787 &linestring_centroid_sum[0],
1789 &point_centroid_sum[0]);
1792 if (total_area2 != 0.0) {
1793 mpoly_centroid[0] = cg3[0] / 3 / total_area2;
1794 mpoly_centroid[1] = cg3[1] / 3 / total_area2;
1795 }
else if (total_length > 0.0) {
1797 mpoly_centroid[0] = linestring_centroid_sum[0] / total_length;
1798 mpoly_centroid[1] = linestring_centroid_sum[1] / total_length;
1799 }
else if (num_points > 0) {
1801 mpoly_centroid[0] = point_centroid_sum[0] / num_points;
1802 mpoly_centroid[1] = point_centroid_sum[1] / num_points;
1804 Point2D centroid =
get_point(mpoly_coords, 0, ic, isr, osr);
1805 mpoly_centroid[0] = centroid.x;
1806 mpoly_centroid[1] = centroid.y;
1824 Point2D
const pt1 =
get_point(p1, 0, ic1, isr1, osr);
1825 Point2D
const pt2 =
get_point(p2, 0, ic2, isr2, osr);
1839 Point2D
const pt1 =
get_point(p1, 0, ic1, isr1, osr);
1840 Point2D
const pt2 =
get_point(p2, 0, ic2, isr2, osr);
1854 Point2D
const pt1 =
get_point(p1, 0, ic1, 4326, 4326);
1855 Point2D
const pt2 =
get_point(p2, 0, ic2, 4326, 4326);
1870 Point2D
const pt =
get_point(p, 0, ic1, 4326, 4326);
1872 Point2D
const pl =
get_point(l, 2 * (lpoints - 1), ic2, 4326, 4326);
1888 p, psize, l, lsize, ic2, isr2, ic1, isr1, osr);
1902 Point2D pt =
get_point(p, 0, ic1, isr1, osr);
1904 Point2D mpp =
get_point(mp, 0, ic2, isr2, osr);
1906 for (int32_t i = 2; i < mp_num_coords; i += 2) {
1912 if (dist <= threshold) {
1930 Point2D pt =
get_point(p, 0, ic1, isr1, osr);
1932 Point2D mpp =
get_point(mp, 0, ic2, isr2, osr);
1934 for (int32_t i = 2; i < mp_num_coords; i += 2) {
1940 if (dist <= threshold) {
1958 Point2D pt =
get_point(p, 0, ic1, isr1, osr);
1962 Point2D l1 =
get_point(l, 0, ic2, isr2, osr);
1963 Point2D l2 =
get_point(l, 2, ic2, isr2, osr);
1966 for (int32_t i = 4; i < l_num_coords; i += 2) {
1973 if (dist <= threshold) {
1977 if (l_num_coords > 4 && check_closed) {
2000 p, psize, l, lsize, ic1, isr1, ic2, isr2, osr,
true, threshold);
2015 p, psize, l, lsize, ic1, isr1, ic2, isr2, osr,
false, threshold);
2022 int32_t* mls_ls_sizes,
2030 if (mls_ls_num <= 0) {
2033 double min_distance = 0.0;
2035 auto next_linestring_coords = mls;
2037 for (
auto l = 0; l < mls_ls_num; l++) {
2038 auto linestring_coords = next_linestring_coords;
2039 auto linestring_num_points = mls_ls_sizes[l];
2040 auto linestring_num_coords = 2 * linestring_num_points;
2042 next_linestring_coords += linestring_coords_size;
2046 linestring_coords_size,
2054 if (l == 0 || min_distance > distance) {
2055 min_distance = distance;
2060 if (min_distance <= threshold) {
2066 return min_distance;
2074 int32_t* mls_ls_sizes,
2100 int32_t* poly_ring_sizes,
2101 int64_t poly_num_rings,
2109 if (poly_num_rings > 0) {
2110 exterior_ring_num_coords = poly_ring_sizes[0] * 2;
2114 Point2D pt =
get_point(p, 0, ic1, isr1, osr);
2116 poly, exterior_ring_num_coords, pt.x, pt.y, ic2, isr2, osr)) {
2119 p, psize, poly, exterior_ring_coords_size, ic1, isr1, ic2, isr2, osr, threshold);
2123 poly += exterior_ring_coords_size;
2125 for (
auto r = 1; r < poly_num_rings; r++) {
2126 auto interior_ring_num_coords = poly_ring_sizes[r] * 2;
2127 auto interior_ring_coords_size =
2130 poly, interior_ring_num_coords, pt.x, pt.y, ic2, isr2, osr)) {
2135 interior_ring_coords_size,
2143 poly += interior_ring_coords_size;
2150 int8_t* mpoly_coords,
2151 int64_t mpoly_coords_size,
2152 int32_t* mpoly_ring_sizes,
2153 int64_t mpoly_num_rings,
2154 int32_t* mpoly_poly_sizes,
2155 int64_t mpoly_num_polys,
2162 if (mpoly_num_polys <= 0) {
2165 double min_distance = 0.0;
2168 auto next_poly_coords = mpoly_coords;
2169 auto next_poly_ring_sizes = mpoly_ring_sizes;
2171 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
2172 auto poly_coords = next_poly_coords;
2173 auto poly_ring_sizes = next_poly_ring_sizes;
2174 auto poly_num_rings = mpoly_poly_sizes[poly];
2176 int32_t poly_num_coords = 0;
2177 for (
auto ring = 0; ring < poly_num_rings; ring++) {
2178 poly_num_coords += 2 * *next_poly_ring_sizes++;
2181 next_poly_coords += poly_coords_size;
2194 if (poly == 0 || min_distance > distance) {
2195 min_distance = distance;
2200 if (min_distance <= threshold) {
2206 return min_distance;
2214 int32_t* poly_ring_sizes,
2215 int64_t poly_num_rings,
2239 int8_t* mpoly_coords,
2240 int64_t mpoly_coords_size,
2241 int32_t* mpoly_ring_sizes,
2242 int64_t mpoly_num_rings,
2243 int32_t* mpoly_poly_sizes,
2244 int64_t mpoly_num_polys,
2272 int32_t* poly_ring_sizes,
2273 int64_t poly_num_rings,
2296 for (int32_t i = 2; i < mp_num_coords; i += 2) {
2313 if (dist <= threshold) {
2323 int8_t* mpoly_coords,
2324 int64_t mpoly_coords_size,
2325 int32_t* mpoly_ring_sizes,
2326 int64_t mpoly_num_rings,
2327 int32_t* mpoly_poly_sizes,
2328 int64_t mpoly_num_polys,
2353 for (int32_t i = 2; i < mp_num_coords; i += 2) {
2372 if (dist <= threshold) {
2382 int32_t* poly_ring_sizes,
2383 int64_t poly_num_rings,
2408 int64_t mpoly_coords_size,
2409 int32_t* mpoly_ring_sizes,
2410 int64_t mpoly_num_rings,
2411 int32_t* mpoly_poly_sizes,
2412 int64_t mpoly_num_polys,
2449 p, psize, mp, mpsize, ic2, isr2, ic1, isr1, osr, threshold);
2464 p, psize, mp, mpsize, ic2, isr2, ic1, isr1, osr, threshold);
2481 for (int32_t i = 0; i < mp1_num_coords; i += 2) {
2482 Point2D mp1p =
get_point(mp1, 0, ic1, isr1, osr);
2483 for (int32_t j = 0; j < mp2_num_coords; j += 2) {
2484 Point2D mp2p =
get_point(mp2, 0, ic2, isr2, osr);
2486 if (dist > ldist || dist < 0.0) {
2489 if (dist <= threshold) {
2511 for (int32_t i = 0; i < mp1_num_coords; i += 2) {
2512 Point2D mp1p =
get_point(mp1, i, ic1, isr1, osr);
2513 for (int32_t j = 0; j < mp2_num_coords; j += 2) {
2514 Point2D mp2p =
get_point(mp2, j, ic2, isr2, osr);
2516 if (dist > ldist || dist < 0.0) {
2519 if (dist <= threshold) {
2542 p, psize, l, lsize, ic1, isr1, ic2, isr2, osr,
true, threshold);
2544 for (int32_t i = 2; i < mp_num_coords; i += 2) {
2546 p, psize, l, lsize, ic1, isr1, ic2, isr2, osr,
true, threshold);
2551 if (dist <= threshold) {
2563 int32_t* mls_ls_sizes,
2587 for (int32_t i = 2; i < mp_num_coords; i += 2) {
2604 if (dist <= threshold) {
2623 p, psize, l, lsize, ic2, isr2, ic1, isr1, osr, threshold);
2638 mp, mpsize, l, lsize, ic2, isr2, ic1, isr1, osr, threshold);
2644 int32_t* mls_ls_sizes,
2682 double threshold_squared = threshold * threshold;
2683 double dist_squared = 0.0;
2684 Point2D l11 =
get_point(l1, 0, ic1, isr1, osr);
2685 for (int32_t i1 = 2; i1 < l1_num_coords; i1 += 2) {
2686 Point2D l12 =
get_point(l1, i1, ic1, isr1, osr);
2687 Point2D l21 =
get_point(l2, 0, ic2, isr2, osr);
2688 for (int32_t i2 = 2; i2 < l2_num_coords; i2 += 2) {
2689 Point2D l22 =
get_point(l2, i2, ic2, isr2, osr);
2696 double ldist_squared = ldist * ldist;
2698 if (i1 == 2 && i2 == 2) {
2699 dist_squared = ldist_squared;
2701 }
else if (dist_squared > ldist_squared) {
2702 dist_squared = ldist_squared;
2707 if (dist_squared <= threshold_squared) {
2710 return sqrt(dist_squared);
2718 return sqrt(dist_squared);
2724 int8_t* poly_coords,
2725 int64_t poly_coords_size,
2726 int32_t* poly_ring_sizes,
2727 int64_t poly_num_rings,
2753 if (min_distance <= threshold) {
2754 return min_distance;
2760 auto poly_ring_coords = poly_coords;
2761 for (
auto r = 0; r < poly_num_rings; r++) {
2762 int64_t poly_ring_num_coords = poly_ring_sizes[r] * 2;
2765 poly_ring_num_coords,
2774 if (min_distance > distance) {
2775 min_distance = distance;
2779 if (min_distance <= threshold) {
2780 return min_distance;
2787 return min_distance;
2793 int8_t* mpoly_coords,
2794 int64_t mpoly_coords_size,
2795 int32_t* mpoly_ring_sizes,
2796 int64_t mpoly_num_rings,
2797 int32_t* mpoly_poly_sizes,
2798 int64_t mpoly_num_polys,
2806 double min_distance = 0.0;
2809 auto next_poly_coords = mpoly_coords;
2810 auto next_poly_ring_sizes = mpoly_ring_sizes;
2812 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
2813 auto poly_coords = next_poly_coords;
2814 auto poly_ring_sizes = next_poly_ring_sizes;
2815 auto poly_num_rings = mpoly_poly_sizes[poly];
2817 int32_t poly_num_coords = 0;
2818 for (
auto ring = 0; ring < poly_num_rings; ring++) {
2819 poly_num_coords += 2 * *next_poly_ring_sizes++;
2822 next_poly_coords += poly_coords_size;
2835 if (poly == 0 || min_distance > distance) {
2836 min_distance = distance;
2841 if (min_distance <= threshold) {
2842 return min_distance;
2847 return min_distance;
2853 int32_t* mls_ls_sizes,
2879 int64_t poly_coords_size,
2880 int32_t* poly_ring_sizes,
2881 int64_t poly_num_rings,
2906 int64_t poly_coords_size,
2907 int32_t* poly_ring_sizes,
2908 int64_t poly_num_rings,
2933 int64_t poly1_coords_size,
2934 int32_t* poly1_ring_sizes,
2935 int64_t poly1_num_rings,
2936 int8_t* poly2_coords,
2937 int64_t poly2_coords_size,
2938 int32_t* poly2_ring_sizes,
2939 int64_t poly2_num_rings,
2947 auto poly2_first_point_coords = poly2_coords;
2953 poly2_first_point_coords,
2954 poly2_first_point_coords_size,
2965 if (min_distance <= threshold) {
2966 return min_distance;
2979 auto poly1_ring_coords = poly1_coords;
2980 for (
auto r1 = 0; r1 < poly1_num_rings; r1++) {
2981 int64_t poly1_ring_num_coords = poly1_ring_sizes[r1] * 2;
2983 auto poly2_ring_coords = poly2_coords;
2984 for (
auto r2 = 0; r2 < poly2_num_rings; r2++) {
2985 int64_t poly2_ring_num_coords = poly2_ring_sizes[r2] * 2;
2988 poly1_ring_num_coords,
2990 poly2_ring_num_coords,
2997 if (min_distance > distance) {
2998 min_distance = distance;
3002 if (min_distance <= threshold) {
3003 return min_distance;
3013 return min_distance;
3018 int64_t poly1_coords_size,
3019 int32_t* poly1_ring_sizes,
3020 int64_t poly1_num_rings,
3021 int8_t* mpoly_coords,
3022 int64_t mpoly_coords_size,
3023 int32_t* mpoly_ring_sizes,
3024 int64_t mpoly_num_rings,
3025 int32_t* mpoly_poly_sizes,
3026 int64_t mpoly_num_polys,
3033 double min_distance = 0.0;
3036 auto next_poly_coords = mpoly_coords;
3037 auto next_poly_ring_sizes = mpoly_ring_sizes;
3039 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
3040 auto poly_coords = next_poly_coords;
3041 auto poly_ring_sizes = next_poly_ring_sizes;
3042 auto poly_num_rings = mpoly_poly_sizes[poly];
3044 int32_t poly_num_coords = 0;
3045 for (
auto ring = 0; ring < poly_num_rings; ring++) {
3046 poly_num_coords += 2 * *next_poly_ring_sizes++;
3049 next_poly_coords += poly_coords_size;
3064 if (poly == 0 || min_distance > distance) {
3065 min_distance = distance;
3070 if (min_distance <= threshold) {
3076 return min_distance;
3081 int64_t mpoly_coords_size,
3082 int32_t* mpoly_ring_sizes,
3083 int64_t mpoly_num_rings,
3084 int32_t* mpoly_poly_sizes,
3085 int64_t mpoly_num_polys,
3112 int64_t mpoly_coords_size,
3113 int32_t* mpoly_ring_sizes,
3114 int64_t mpoly_num_rings,
3115 int32_t* mpoly_poly_sizes,
3116 int64_t mpoly_num_polys,
3143 int64_t mpoly_coords_size,
3144 int32_t* mpoly_ring_sizes,
3145 int64_t mpoly_num_rings,
3146 int32_t* mpoly_poly_sizes,
3147 int64_t mpoly_num_polys,
3148 int8_t* poly1_coords,
3149 int64_t poly1_coords_size,
3150 int32_t* poly1_ring_sizes,
3151 int64_t poly1_num_rings,
3178 int64_t mpoly1_coords_size,
3179 int32_t* mpoly1_ring_sizes,
3180 int64_t mpoly1_num_rings,
3181 int32_t* mpoly1_poly_sizes,
3182 int64_t mpoly1_num_polys,
3183 int8_t* mpoly2_coords,
3184 int64_t mpoly2_coords_size,
3185 int32_t* mpoly2_ring_sizes,
3186 int64_t mpoly2_num_rings,
3187 int32_t* mpoly2_poly_sizes,
3188 int64_t mpoly2_num_polys,
3195 double min_distance = 0.0;
3199 auto next_poly_coords = mpoly1_coords;
3200 auto next_poly_ring_sizes = mpoly1_ring_sizes;
3202 for (
auto poly = 0; poly < mpoly1_num_polys; poly++) {
3203 auto poly_coords = next_poly_coords;
3204 auto poly_ring_sizes = next_poly_ring_sizes;
3205 auto poly_num_rings = mpoly1_poly_sizes[poly];
3207 int32_t poly_num_coords = 0;
3208 for (
auto ring = 0; ring < poly_num_rings; ring++) {
3209 poly_num_coords += 2 * *next_poly_ring_sizes++;
3212 next_poly_coords += poly_coords_size;
3229 if (poly == 0 || min_distance > distance) {
3230 min_distance = distance;
3235 if (min_distance <= threshold) {
3241 return min_distance;
3247 int32_t* mls1_ls_sizes,
3248 int64_t mls1_ls_num,
3251 int32_t* mls2_ls_sizes,
3252 int64_t mls2_ls_num,
3276 double distance_within) {
3278 p1, p1size, p2, p2size, ic1, isr1, ic2, isr2, osr) <=
3279 distance_within * distance_within;
3292 double distance_within) {
3295 return (dist_meters <= distance_within);
3304 int64_t l2bounds_size,
3310 double distance_within) {
3314 p1, p1size, ic1, isr1, l2bounds, l2bounds_size, isr2, osr, distance_within)) {
3320 const double threshold = distance_within;
3322 p1, p1size, l2, l2size, ic1, isr1, ic2, isr2, osr, threshold) <=
3329 int8_t* poly_coords,
3330 int64_t poly_coords_size,
3331 int32_t* poly_ring_sizes,
3332 int64_t poly_num_rings,
3333 double* poly_bounds,
3334 int64_t poly_bounds_size,
3340 double distance_within) {
3356 const double threshold = distance_within;
3368 threshold) <= distance_within;
3374 int8_t* mpoly_coords,
3375 int64_t mpoly_coords_size,
3376 int32_t* mpoly_ring_sizes,
3377 int64_t mpoly_num_rings,
3378 int32_t* mpoly_poly_sizes,
3379 int64_t mpoly_num_polys,
3380 double* mpoly_bounds,
3381 int64_t mpoly_bounds_size,
3387 double distance_within) {
3403 const double threshold = distance_within;
3417 threshold) <= distance_within;
3424 int64_t l1bounds_size,
3428 int64_t l2bounds_size,
3434 double distance_within) {
3435 if (l1bounds && l2bounds) {
3450 const double threshold = distance_within;
3452 l1, l1size, l2, l2size, ic1, isr1, ic2, isr2, osr, threshold) <=
3460 int64_t l1bounds_size,
3461 int8_t* poly_coords,
3462 int64_t poly_coords_size,
3463 int32_t* poly_ring_sizes,
3464 int64_t poly_num_rings,
3465 double* poly_bounds,
3466 int64_t poly_bounds_size,
3472 double distance_within) {
3473 if (l1bounds && poly_bounds) {
3488 CoordData l1_relevant_section{l1, l1size};
3494 l1, l1size, ic1, isr1, poly_bounds, poly_bounds_size, isr2, osr, distance_within);
3495 if (!l1_relevant_section.ptr) {
3506 const double threshold = distance_within;
3508 l1_relevant_section.size,
3518 threshold) <= distance_within;
3525 int64_t l1bounds_size,
3526 int8_t* mpoly_coords,
3527 int64_t mpoly_coords_size,
3528 int32_t* mpoly_ring_sizes,
3529 int64_t mpoly_num_rings,
3530 int32_t* mpoly_poly_sizes,
3531 int64_t mpoly_num_polys,
3532 double* mpoly_bounds,
3533 int64_t mpoly_bounds_size,
3539 double distance_within) {
3540 if (l1bounds && mpoly_bounds) {
3555 CoordData l1_relevant_section{l1, l1size};
3569 if (!l1_relevant_section.ptr) {
3581 const double threshold = distance_within;
3583 l1_relevant_section.size,
3595 threshold) <= distance_within;
3600 int64_t poly1_coords_size,
3601 int32_t* poly1_ring_sizes,
3602 int64_t poly1_num_rings,
3603 double* poly1_bounds,
3604 int64_t poly1_bounds_size,
3605 int8_t* poly2_coords,
3606 int64_t poly2_coords_size,
3607 int32_t* poly2_ring_sizes,
3608 int64_t poly2_num_rings,
3609 double* poly2_bounds,
3610 int64_t poly2_bounds_size,
3616 double distance_within) {
3617 if (poly1_bounds && poly2_bounds) {
3632 const double threshold = distance_within;
3646 threshold) <= distance_within;
3651 int64_t poly_coords_size,
3652 int32_t* poly_ring_sizes,
3653 int64_t poly_num_rings,
3654 double* poly_bounds,
3655 int64_t poly_bounds_size,
3656 int8_t* mpoly_coords,
3657 int64_t mpoly_coords_size,
3658 int32_t* mpoly_ring_sizes,
3659 int64_t mpoly_num_rings,
3660 int32_t* mpoly_poly_sizes,
3661 int64_t mpoly_num_polys,
3662 double* mpoly_bounds,
3663 int64_t mpoly_bounds_size,
3669 double distance_within) {
3670 if (poly_bounds && mpoly_bounds) {
3685 const double threshold = distance_within;
3701 threshold) <= distance_within;
3706 int64_t mpoly1_coords_size,
3707 int32_t* mpoly1_ring_sizes,
3708 int64_t mpoly1_num_rings,
3709 int32_t* mpoly1_poly_sizes,
3710 int64_t mpoly1_num_polys,
3711 double* mpoly1_bounds,
3712 int64_t mpoly1_bounds_size,
3713 int8_t* mpoly2_coords,
3714 int64_t mpoly2_coords_size,
3715 int32_t* mpoly2_ring_sizes,
3716 int64_t mpoly2_num_rings,
3717 int32_t* mpoly2_poly_sizes,
3718 int64_t mpoly2_num_polys,
3719 double* mpoly2_bounds,
3720 int64_t mpoly2_bounds_size,
3726 double distance_within) {
3727 if (mpoly1_bounds && mpoly2_bounds) {
3742 const double threshold = distance_within;
3760 threshold) <= distance_within;
3778 if (length1 > length2) {
3793 bool check_closed) {
3795 Point2D pt =
get_point(p, 0, ic1, isr1, osr);
3799 Point2D l1 =
get_point(l, 0, ic2, isr2, osr);
3800 Point2D l2 =
get_point(l, 2, ic2, isr2, osr);
3803 for (int32_t i = 4; i < l_num_coords; i += 2) {
3807 if (max_dist < ldist) {
3811 if (l_num_coords > 4 && check_closed) {
3815 if (max_dist < ldist) {
3833 p, psize, l, lsize, ic1, isr1, ic2, isr2, osr,
false);
3847 p, psize, l, lsize, ic2, isr2, ic1, isr1, osr,
false);
3866 Point2D
const pt1 =
get_point(p1, 0, ic1, isr1, osr);
3867 Point2D
const pt2 =
get_point(p2, 0, ic2, isr2, osr);
3868 double tolerance =
tol(ic1, ic2);
3869 return tol_eq(pt1.x, pt2.x, tolerance) &&
tol_eq(pt1.y, pt2.y, tolerance);
3878 int64_t lbounds_size,
3884 Point2D
const pt =
get_point(p, 0, ic1, isr1, osr);
3887 if (
tol_eq(pt.x, lbounds[0]) &&
tol_eq(pt.y, lbounds[1]) &&
3888 tol_eq(pt.x, lbounds[2]) &&
tol_eq(pt.y, lbounds[3])) {
3894 for (
int i = 0; i < l_num_coords; i += 2) {
3895 Point2D pl =
get_point(l, i, ic2, isr2, osr);
3907 int8_t* poly_coords,
3908 int64_t poly_coords_size,
3909 int32_t* poly_ring_sizes,
3910 int64_t poly_num_rings,
3911 double* poly_bounds,
3912 int64_t poly_bounds_size,
3919 if (poly_num_rings > 0) {
3920 exterior_ring_num_coords = poly_ring_sizes[0] * 2;
3927 exterior_ring_coords_size,
3941 int64_t lbounds_size,
3957 int64_t lbounds_size,
3958 int8_t* poly_coords,
3959 int64_t poly_coords_size,
3960 int32_t* poly_ring_sizes,
3961 int64_t poly_num_rings,
3962 double* poly_bounds,
3963 int64_t poly_bounds_size,
3973 template <
typename T, EdgeBehavior TEdgeBehavior>
3975 const int64_t poly_coords_size,
3976 const int32_t* poly_ring_sizes,
3977 const int64_t poly_num_rings,
3978 const double* poly_bounds,
3979 const int64_t poly_bounds_size,
3981 const int64_t psize,
3986 const int32_t osr) {
3989 Point2D
const pt =
get_point(p, 0, ic2, isr2, osr);
3991 DEBUG_STMT(printf(
"Bounding box does not contain point, exiting.\n"));
3996 auto get_x_coord = [=]() ->
T {
3997 if constexpr (std::is_floating_point<T>::value) {
3998 return get_point(p, 0, ic2, isr2, osr).x;
4005 auto get_y_coord = [=]() ->
T {
4006 if constexpr (std::is_floating_point<T>::value) {
4007 return get_point(p, 0, ic2, isr2, osr).y;
4014 const T px = get_x_coord();
4015 const T py = get_y_coord();
4016 DEBUG_STMT(printf(
"pt: %f, %f\n", (
double)px, (
double)py));
4019 auto exterior_ring_num_coords =
4020 poly_num_rings > 0 ? poly_ring_sizes[0] * 2 : poly_num_coords;
4022 auto poly = poly_coords;
4023 if (point_in_polygon_winding_number<T, TEdgeBehavior>(
4024 poly, exterior_ring_num_coords, px, py, ic1, isr1, osr)) {
4028 for (
auto r = 1; r < poly_num_rings; r++) {
4029 const int64_t interior_ring_num_coords = poly_ring_sizes[r] * 2;
4030 if (point_in_polygon_winding_number<T, TEdgeBehavior>(
4031 poly, interior_ring_num_coords, px, py, ic1, isr1, osr)) {
4042 const int64_t poly_coords_size,
4043 const int32_t* poly_ring_sizes,
4044 const int64_t poly_num_rings,
4045 const double* poly_bounds,
4046 const int64_t poly_bounds_size,
4048 const int64_t psize,
4053 const int32_t osr) {
4054 return Contains_Polygon_Point_Impl<double, EdgeBehavior::kExcludePointOnEdge>(
4071 const int64_t poly_coords_size,
4072 const int32_t* poly_ring_sizes,
4073 const int64_t poly_num_rings,
4074 const double* poly_bounds,
4075 const int64_t poly_bounds_size,
4077 const int64_t psize,
4082 const int32_t osr) {
4083 return Contains_Polygon_Point_Impl<int64_t, EdgeBehavior::kExcludePointOnEdge>(
4101 int64_t poly_coords_size,
4102 int32_t* poly_ring_sizes,
4103 int64_t poly_num_rings,
4104 double* poly_bounds,
4105 int64_t poly_bounds_size,
4109 int64_t lbounds_size,
4115 if (poly_num_rings > 1) {
4120 if (poly_bounds && lbounds) {
4121 if (!
box_contains_box(poly_bounds, poly_bounds_size, lbounds, lbounds_size)) {
4130 poly_coords, poly_num_coords, l, lnum_coords, ic1, isr1, ic2, isr2, osr);
4135 int64_t poly1_coords_size,
4136 int32_t* poly1_ring_sizes,
4137 int64_t poly1_num_rings,
4138 double* poly1_bounds,
4139 int64_t poly1_bounds_size,
4140 int8_t* poly2_coords,
4141 int64_t poly2_coords_size,
4142 int32_t* poly2_ring_sizes,
4143 int64_t poly2_num_rings,
4144 double* poly2_bounds,
4145 int64_t poly2_bounds_size,
4153 if (poly1_num_rings > 1) {
4157 if (poly1_bounds && poly2_bounds) {
4159 poly1_bounds, poly1_bounds_size, poly2_bounds, poly2_bounds_size)) {
4164 int64_t poly2_exterior_ring_coords_size = poly2_coords_size;
4165 if (poly2_num_rings > 0) {
4166 poly2_exterior_ring_coords_size =
4176 poly2_exterior_ring_coords_size,
4186 template <
typename T, EdgeBehavior TEdgeBehavior>
4188 const int8_t* mpoly_coords,
4189 const int64_t mpoly_coords_size,
4190 const int32_t* mpoly_ring_sizes,
4191 const int64_t mpoly_num_rings,
4192 const int32_t* mpoly_poly_sizes,
4193 const int64_t mpoly_num_polys,
4194 const double* mpoly_bounds,
4195 const int64_t mpoly_bounds_size,
4197 const int64_t psize,
4202 const int32_t osr) {
4203 if (mpoly_num_polys <= 0) {
4210 Point2D
const pt =
get_point(p, 0, ic2, isr2, osr);
4218 auto next_poly_coords = mpoly_coords;
4219 auto next_poly_ring_sizes = mpoly_ring_sizes;
4221 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
4222 const auto poly_coords = next_poly_coords;
4223 const auto poly_ring_sizes = next_poly_ring_sizes;
4224 const auto poly_num_rings = mpoly_poly_sizes[poly];
4226 int32_t poly_num_coords = 0;
4227 for (
auto ring = 0; ring < poly_num_rings; ring++) {
4228 poly_num_coords += 2 * *next_poly_ring_sizes++;
4231 next_poly_coords += poly_coords_size;
4233 if (Contains_Polygon_Point_Impl<T, TEdgeBehavior>(poly_coords,
4255 int64_t mpoly_coords_size,
4256 int32_t* mpoly_ring_sizes,
4257 int64_t mpoly_num_rings,
4258 int32_t* mpoly_poly_sizes,
4259 int64_t mpoly_num_polys,
4260 double* mpoly_bounds,
4261 int64_t mpoly_bounds_size,
4269 return Contains_MultiPolygon_Point_Impl<double, EdgeBehavior::kExcludePointOnEdge>(
4288 int64_t mpoly_coords_size,
4289 int32_t* mpoly_ring_sizes,
4290 int64_t mpoly_num_rings,
4291 int32_t* mpoly_poly_sizes,
4292 int64_t mpoly_num_polys,
4293 double* mpoly_bounds,
4294 int64_t mpoly_bounds_size,
4302 return Contains_MultiPolygon_Point_Impl<int64_t, EdgeBehavior::kExcludePointOnEdge>(
4322 int64_t mpoly_coords_size,
4323 int32_t* mpoly_ring_sizes,
4324 int64_t mpoly_num_rings,
4325 int32_t* mpoly_poly_sizes,
4326 int64_t mpoly_num_polys,
4327 double* mpoly_bounds,
4328 int64_t mpoly_bounds_size,
4332 int64_t lbounds_size,
4338 if (mpoly_num_polys <= 0) {
4342 if (mpoly_bounds && lbounds) {
4343 if (!
box_contains_box(mpoly_bounds, mpoly_bounds_size, lbounds, lbounds_size)) {
4349 auto next_poly_coords = mpoly_coords;
4350 auto next_poly_ring_sizes = mpoly_ring_sizes;
4352 for (
auto poly = 0; poly < mpoly_num_polys; poly++) {
4353 auto poly_coords = next_poly_coords;
4354 auto poly_ring_sizes = next_poly_ring_sizes;
4355 auto poly_num_rings = mpoly_poly_sizes[poly];
4357 int32_t poly_num_coords = 0;
4358 for (
auto ring = 0; ring < poly_num_rings; ring++) {
4359 poly_num_coords += 2 * *next_poly_ring_sizes++;
4362 next_poly_coords += poly_coords_size;
4410 int64_t lbounds_size,
4417 Point2D
const pt =
get_point(p, 0, ic1, isr1, osr);
4431 int32_t* poly_ring_sizes,
4432 int64_t poly_num_rings,
4433 double* poly_bounds,
4434 int64_t poly_bounds_size,
4440 return Contains_Polygon_Point_Impl<double, EdgeBehavior::kIncludePointOnEdge>(
4459 int8_t* mpoly_coords,
4460 int64_t mpoly_coords_size,
4461 int32_t* mpoly_ring_sizes,
4462 int64_t mpoly_num_rings,
4463 int32_t* mpoly_poly_sizes,
4464 int64_t mpoly_num_polys,
4465 double* mpoly_bounds,
4466 int64_t mpoly_bounds_size,
4472 return Contains_MultiPolygon_Point_Impl<double, EdgeBehavior::kIncludePointOnEdge>(
4494 int64_t lbounds_size,
4503 p, psize, l, lsize, lbounds, lbounds_size, ic2, isr2, ic1, isr1, osr);
4510 int64_t l1bounds_size,
4514 int64_t l2bounds_size,
4520 if (l1bounds && l2bounds) {
4527 l1, l1size, l2, l2size, ic1, isr1, ic2, isr2, osr, 0.0));
4534 int64_t lbounds_size,
4537 int32_t* poly_ring_sizes,
4538 int64_t poly_num_rings,
4539 double* poly_bounds,
4540 int64_t poly_bounds_size,
4546 if (lbounds && poly_bounds) {
4547 if (!
box_overlaps_box(lbounds, lbounds_size, poly_bounds, poly_bounds_size)) {
4577 int64_t lbounds_size,
4578 int8_t* mpoly_coords,
4579 int64_t mpoly_coords_size,
4580 int32_t* mpoly_ring_sizes,
4581 int64_t mpoly_num_rings,
4582 int32_t* mpoly_poly_sizes,
4583 int64_t mpoly_num_polys,
4584 double* mpoly_bounds,
4585 int64_t mpoly_bounds_size,
4591 if (lbounds && mpoly_bounds) {
4592 if (!
box_overlaps_box(lbounds, lbounds_size, mpoly_bounds, mpoly_bounds_size)) {
4623 int32_t* poly_ring_sizes,
4624 int64_t poly_num_rings,
4625 double* poly_bounds,
4626 int64_t poly_bounds_size,
4634 return Contains_Polygon_Point_Impl<double, EdgeBehavior::kIncludePointOnEdge>(
4653 int32_t* poly_ring_sizes,
4654 int64_t poly_num_rings,
4655 double* poly_bounds,
4656 int64_t poly_bounds_size,
4664 return Contains_Polygon_Point_Impl<int64_t, EdgeBehavior::kIncludePointOnEdge>(
4683 int32_t* poly_ring_sizes,
4684 int64_t poly_num_rings,
4685 double* poly_bounds,
4686 int64_t poly_bounds_size,
4690 int64_t lbounds_size,
4715 int64_t poly1_coords_size,
4716 int32_t* poly1_ring_sizes,
4717 int64_t poly1_num_rings,
4718 double* poly1_bounds,
4719 int64_t poly1_bounds_size,
4720 int8_t* poly2_coords,
4721 int64_t poly2_coords_size,
4722 int32_t* poly2_ring_sizes,
4723 int64_t poly2_num_rings,
4724 double* poly2_bounds,
4725 int64_t poly2_bounds_size,
4731 if (poly1_bounds && poly2_bounds) {
4733 poly1_bounds, poly1_bounds_size, poly2_bounds, poly2_bounds_size)) {
4756 int64_t poly_coords_size,
4757 int32_t* poly_ring_sizes,
4758 int64_t poly_num_rings,
4759 double* poly_bounds,
4760 int64_t poly_bounds_size,
4761 int8_t* mpoly_coords,
4762 int64_t mpoly_coords_size,
4763 int32_t* mpoly_ring_sizes,
4764 int64_t mpoly_num_rings,
4765 int32_t* mpoly_poly_sizes,
4766 int64_t mpoly_num_polys,
4767 double* mpoly_bounds,
4768 int64_t mpoly_bounds_size,
4774 if (poly_bounds && mpoly_bounds) {
4776 poly_bounds, poly_bounds_size, mpoly_bounds, mpoly_bounds_size)) {
4801 int64_t mpoly_coords_size,
4802 int32_t* mpoly_ring_sizes,
4803 int64_t mpoly_num_rings,
4804 int32_t* mpoly_poly_sizes,
4805 int64_t mpoly_num_polys,
4806 double* mpoly_bounds,
4807 int64_t mpoly_bounds_size,
4815 return Contains_MultiPolygon_Point_Impl<double, EdgeBehavior::kIncludePointOnEdge>(
4835 int64_t mpoly_coords_size,
4836 int32_t* mpoly_ring_sizes,
4837 int64_t mpoly_num_rings,
4838 int32_t* mpoly_poly_sizes,
4839 int64_t mpoly_num_polys,
4840 double* mpoly_bounds,
4841 int64_t mpoly_bounds_size,
4849 return Contains_MultiPolygon_Point_Impl<int64_t, EdgeBehavior::kIncludePointOnEdge>(
4869 int64_t mpoly_coords_size,
4870 int32_t* mpoly_ring_sizes,
4871 int64_t mpoly_num_rings,
4872 int32_t* mpoly_poly_sizes,
4873 int64_t mpoly_num_polys,
4874 double* mpoly_bounds,
4875 int64_t mpoly_bounds_size,
4879 int64_t lbounds_size,
4906 int64_t mpoly_coords_size,
4907 int32_t* mpoly_ring_sizes,
4908 int64_t mpoly_num_rings,
4909 int32_t* mpoly_poly_sizes,
4910 int64_t mpoly_num_polys,
4911 double* mpoly_bounds,
4912 int64_t mpoly_bounds_size,
4913 int8_t* poly_coords,
4914 int64_t poly_coords_size,
4915 int32_t* poly_ring_sizes,
4916 int64_t poly_num_rings,
4917 double* poly_bounds,
4918 int64_t poly_bounds_size,
4947 int64_t mpoly1_coords_size,
4948 int32_t* mpoly1_ring_sizes,
4949 int64_t mpoly1_num_rings,
4950 int32_t* mpoly1_poly_sizes,
4951 int64_t mpoly1_num_polys,
4952 double* mpoly1_bounds,
4953 int64_t mpoly1_bounds_size,
4954 int8_t* mpoly2_coords,
4955 int64_t mpoly2_coords_size,
4956 int32_t* mpoly2_ring_sizes,
4957 int64_t mpoly2_num_rings,
4958 int32_t* mpoly2_poly_sizes,
4959 int64_t mpoly2_num_polys,
4960 double* mpoly2_bounds,
4961 int64_t mpoly2_bounds_size,
4967 if (mpoly1_bounds && mpoly2_bounds) {
4969 mpoly1_bounds, mpoly1_bounds_size, mpoly2_bounds, mpoly2_bounds_size)) {
4996 return reinterpret_cast<int64_t
>(bounds);
5003 const int64_t psize,
5007 const double min_lon,
5008 const double max_lon,
5009 const int32_t img_width,
5010 const double min_width) {
5011 const double const1 = 0.017453292519943295769236907684886;
5012 const double const2 = 6372797.560856;
5013 const auto lon = decompress_coord<X>(p, 0, ic);
5014 const auto lat = decompress_coord<Y>(p, 0, ic);
5015 double t1 = sinf(meters / (2.0 * const2));
5016 double t2 = cosf(const1 * lat);
5017 const double newlon = lon - (2.0 * asinf(t1 / t2)) / const1;
5018 t1 = transform_point<X>({lon, {}}, isr, osr).x;
5019 t2 = transform_point<X>({newlon, {}}, isr, osr).x;
5020 const double min_domain_x = transform_point<X>({min_lon, {}}, isr, osr).x;
5021 const double max_domain_x = transform_point<X>({max_lon, {}}, isr, osr).x;
5022 const double domain_diff = max_domain_x - min_domain_x;
5023 t1 = ((t1 - min_domain_x) / domain_diff) *
static_cast<double>(img_width);
5024 t2 = ((t2 - min_domain_x) / domain_diff) *
static_cast<double>(img_width);
5027 const double sz = fabs(t1 - t2);
5028 return (sz < min_width ? min_width : sz);
5035 const int64_t psize,
5039 const double min_lat,
5040 const double max_lat,
5041 const int32_t img_height,
5042 const double min_height) {
5043 const double const1 = 0.017453292519943295769236907684886;
5044 const double const2 = 6372797.560856;
5045 const auto lat = decompress_coord<Y>(p, 0, ic);
5046 const double latdiff = meters / (const1 * const2);
5047 const double newlat =
5048 (lat < 0) ? lat + latdiff : lat - latdiff;
5049 double t1 = transform_point<Y>({{}, lat}, isr, osr).y;
5050 double t2 = transform_point<Y>({{}, newlat}, isr, osr).y;
5051 const double min_domain_y = transform_point<Y>({{}, min_lat}, isr, osr).y;
5052 const double max_domain_y = transform_point<Y>({{}, max_lat}, isr, osr).y;
5053 const double domain_diff = max_domain_y - min_domain_y;
5054 t1 = ((t1 - min_domain_y) / domain_diff) *
static_cast<double>(img_height);
5055 t2 = ((t2 - min_domain_y) / domain_diff) *
static_cast<double>(img_height);
5058 const double sz = fabs(t1 - t2);
5059 return (sz < min_height ? min_height : sz);
5063 const int64_t psize,
5065 const double min_lon,
5066 const double max_lon,
5067 const double min_lat,
5068 const double max_lat) {
5069 const auto lon = decompress_coord<X>(p, 0, ic);
5070 const auto lat = decompress_coord<Y>(p, 0, ic);
5071 return !(lon < min_lon || lon > max_lon || lat < min_lat || lat > max_lat);
5075 const int64_t psize,
5077 const double meters,
5078 const double min_lon,
5079 const double max_lon,
5080 const double min_lat,
5081 const double max_lat) {
5082 const double const1 = 0.017453292519943295769236907684886;
5083 const double const2 = 6372797.560856;
5084 const auto lon = decompress_coord<X>(p, 0, ic);
5085 const auto lat = decompress_coord<Y>(p, 0, ic);
5086 const double latdiff = meters / (const1 * const2);
5087 const double t1 = sinf(meters / (2.0 * const2));
5088 const double t2 = cosf(const1 * lat);
5089 const double londiff = (2.0 * asinf(t1 / t2)) / const1;
5090 return !(lon + londiff < min_lon || lon - londiff > max_lon ||
5091 lat + latdiff < min_lat || lat - latdiff > max_lat);
5097 int8_t* ptr = p.
ptr;
5103 double x =
ST_X_Point(ptr, lsize, ic, isr, osr);
5104 double y =
ST_Y_Point(ptr, lsize, ic, isr, osr);
5110 int8_t* ptr = mp.
ptr;
5116 std::vector<double> coords =
5119 multipoint.transform(isr, osr);
5124 int8_t* ptr = l.
ptr;
5130 std::vector<double> coords =
5133 linestring.transform(isr, osr);
5138 int8_t* ptr = ml.
ptr;
5146 std::vector<double> coords =
5149 std::vector<int32_t> v_linestring_sizes(linestring_sizes,
5150 linestring_sizes + num_linestrings);
5153 multilinestring.transform(isr, osr);
5154 return multilinestring;
5158 int8_t* poly_coords = p.ptr_coords;
5159 int32_t poly_coords_size = p.getCoordsSize();
5160 int32_t* poly_ring_sizes =
reinterpret_cast<int32_t*
>(p.getRingSizes());
5161 int32_t poly_num_rings = p.getNumRings();
5162 int32_t ic = p.getCompression();
5163 int32_t isr = p.getInputSrid();
5164 int32_t osr = p.getOutputSrid();
5166 std::vector<double> coords =
5169 std::vector<int32_t> ring_sizes(poly_ring_sizes, poly_ring_sizes + poly_num_rings);
5171 polygon.transform(isr, osr);
5176 int8_t* poly_coords = mp.ptr_coords;
5177 int32_t poly_coords_size = mp.getCoordsSize();
5178 int32_t* poly_ring_sizes =
reinterpret_cast<int32_t*
>(mp.getRingSizes());
5179 int32_t poly_num_rings = mp.getNumRings();
5180 int32_t* poly_sizes =
reinterpret_cast<int32_t*
>(mp.getPolygonSizes());
5181 int32_t num_polys = mp.getNumPolygons();
5182 int32_t ic = mp.getCompression();
5183 int32_t isr = mp.getInputSrid();
5184 int32_t osr = mp.getOutputSrid();
5186 std::vector<double> coords =
5189 std::vector<int32_t> ring_sizes(poly_ring_sizes, poly_ring_sizes + poly_num_rings);
5190 std::vector<int32_t> poly_rings(poly_sizes, poly_sizes + num_polys);
5193 multipolygon.transform(isr, osr);
5194 return multipolygon;
5295 template <
typename T>
5297 std::vector<uint8_t> bytes;
5299 bool ok = geometry.getWkb(bytes);
5301 return std::string();
5304 std::ostringstream ss;
5305 for (
auto b : bytes) {
5306 ss << std::setfill('0') << std::setw(2) << std::hex << static_cast<int>(b);
5391 #endif // #ifndef __CUDACC__
EXTENSION_NOINLINE double ST_Perimeter_MultiPolygon(int8_t *mpoly_coords, int32_t mpoly_coords_size, int8_t *mpoly_ring_sizes, int32_t mpoly_num_rings, int8_t *mpoly_poly_sizes, int32_t mpoly_num_polys, int32_t ic, int32_t isr, 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)
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)
EXTENSION_NOINLINE double ST_Distance_MultiPoint_MultiPoint_Squared(int8_t *mp1, int64_t mp1size, int8_t *mp2, int64_t mp2size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_INLINE double ST_Distance_MultiPolygon_MultiPoint(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 *mp, int64_t mpsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
DEVICE ALWAYS_INLINE double distance_point_multilinestring(int8_t *p, int64_t psize, int8_t *mls, int64_t mls_size, int32_t *mls_ls_sizes, int64_t mls_ls_num, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
DEVICE ALWAYS_INLINE double length_linestring(int8_t *l, int32_t lsize, int32_t ic, int32_t isr, int32_t osr, bool geodesic, bool check_closed)
DEVICE int64_t getSize() const
EXTENSION_NOINLINE double ST_Distance_LineString_LineString(int8_t *l1, int64_t l1size, int8_t *l2, int64_t l2size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
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_INLINE int64_t HeavyDB_Geo_PolyBoundsPtr(double *bounds, int64_t size)
EXTENSION_INLINE double ST_Distance_MultiPoint_Polygon(int8_t *mp, int64_t mpsize, 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, double threshold)
EXTENSION_INLINE double ST_Distance_LineString_Point_Geodesic(int8_t *l, int64_t lsize, 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_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)
DEVICE int32_t getCoordsSize() const
DEVICE ALWAYS_INLINE Point2D conv_utm_4326(const Point2D point, const int32_t utm_srid)
Geospatial::GeoMultiLineString to_Geospatial_GeoMultiLineString(GeoMultiLineString &ml)
DEVICE ALWAYS_INLINE double area_polygon(int8_t *poly_coords, int32_t poly_coords_size, int8_t *poly_ring_sizes_in, int32_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_INLINE bool ST_DWithin_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, double distance_within)
EXTENSION_INLINE double ST_Distance_MultiPoint_MultiPolygon(int8_t *mp, int64_t mpsize, 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, double threshold)
EXTENSION_INLINE double ST_Distance_MultiPoint_Point_Squared(int8_t *mp, int64_t mpsize, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
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 bool box_dwithin_box(double *bounds1, int64_t bounds1_size, int32_t isr1, double *bounds2, int64_t bounds2_size, int32_t isr2, int32_t osr, double distance)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkb__GeoPoint__cpu_(RowFunctionManager &mgr, GeoPoint &p)
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 TextEncodingNone ST_AsText__GeoMultiLineString__cpu_(RowFunctionManager &mgr, GeoMultiLineString &ml)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkb__GeoLineString__cpu_(RowFunctionManager &mgr, GeoLineString &p)
#define EXTENSION_NOINLINE
EXTENSION_NOINLINE double ST_Distance_Point_LineString_Geodesic(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE double decompress_latitude_coord_geoint32(const int32_t compressed)
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)
Geospatial::GeoLineString to_Geospatial_GeoLineString(GeoLineString &l)
EXTENSION_NOINLINE double ST_XMax(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE double max_distance_point_linestring(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, bool check_closed)
DEVICE int32_t getInputSrid() const
EXTENSION_NOINLINE bool ST_Intersects_LineString_MultiPolygon(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_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)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkb__GeoMultiLineString__cpu_(RowFunctionManager &mgr, GeoMultiLineString &p)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkb__GeoMultiPolygon__cpu_(RowFunctionManager &mgr, GeoMultiPolygon &p)
EXTENSION_NOINLINE double ST_Distance_Point_LineString(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_INLINE bool ST_DWithin_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, double distance_within)
EXTENSION_NOINLINE bool ST_Intersects_LineString_Polygon(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, 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 perimeter_multipolygon(int8_t *mpoly_coords, int32_t mpoly_coords_size, int8_t *mpoly_ring_sizes_in, int32_t mpoly_num_rings, int8_t *mpoly_poly_sizes, int32_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr, bool geodesic)
Simplified core of GeoJSON Polygon coordinates definition.
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, double threshold)
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_Distance_MultiLineString_MultiLineString(int8_t *mls1, int64_t mls1size, int32_t *mls1_ls_sizes, int64_t mls1_ls_num, int8_t *mls2, int64_t mls2size, int32_t *mls2_ls_sizes, int64_t mls2_ls_num, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
DEVICE int32_t getSize() const
EXTENSION_INLINE double ST_YMin_Bounds(double *bounds, int64_t size, int32_t isr, int32_t osr)
Geospatial::GeoMultiPoint to_Geospatial_GeoMultiPoint(GeoMultiPoint &mp)
DEVICE int32_t getNumLineStrings() const
EXTENSION_NOINLINE TextEncodingNone ST_AsText__GeoPolygon__cpu_(RowFunctionManager &mgr, GeoPolygon &p)
EXTENSION_NOINLINE double ST_YMax(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE int32_t compressed_coord(const int8_t *data, const int32_t index)
EXTENSION_INLINE double ST_XMin_Bounds(double *bounds, int64_t size, int32_t isr, int32_t osr)
EXTENSION_NOINLINE bool ST_cContains_Polygon_Point(const int8_t *poly_coords, const int64_t poly_coords_size, const int32_t *poly_ring_sizes, const int64_t poly_num_rings, const double *poly_bounds, const int64_t poly_bounds_size, const int8_t *p, const int64_t psize, const int32_t ic1, const int32_t isr1, const int32_t ic2, const int32_t isr2, const int32_t osr)
DEVICE ALWAYS_INLINE T is_left(const T lx0, const T ly0, const T lx1, const T ly1, const T px, const T py)
DEVICE ALWAYS_INLINE bool Contains_MultiPolygon_Point_Impl(const int8_t *mpoly_coords, const int64_t mpoly_coords_size, const int32_t *mpoly_ring_sizes, const int64_t mpoly_num_rings, const int32_t *mpoly_poly_sizes, const int64_t mpoly_num_polys, const double *mpoly_bounds, const int64_t mpoly_bounds_size, const int8_t *p, const int64_t psize, const int32_t ic1, const int32_t isr1, const int32_t ic2, const int32_t isr2, const int32_t osr)
DEVICE ALWAYS_INLINE double area_triangle(double x1, double y1, double x2, double y2, double x3, double y3)
EXTENSION_INLINE bool ST_DWithin_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, double distance_within)
EXTENSION_NOINLINE double ST_XMin(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
DEVICE int32_t getOutputSrid() const
EXTENSION_NOINLINE TextEncodingNone ST_AsWkt__GeoMultiLineString__cpu_(RowFunctionManager &mgr, GeoMultiLineString &p)
EXTENSION_INLINE double ST_Distance_MultiPoint_MultiLineString(int8_t *mp, int64_t mpsize, int8_t *mls, int64_t mls_size, int32_t *mls_ls_sizes, int64_t mls_ls_num, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
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_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, double threshold)
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)
DEVICE int32_t getCompression() const
Geospatial::GeoPoint to_Geospatial_GeoPoint(GeoPoint &p)
EXTENSION_INLINE bool ST_DWithin_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, double distance_within)
EXTENSION_NOINLINE double ST_Y_Point(int8_t *p, int64_t psize, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Point_MultiPoint_Squared(int8_t *p, int64_t psize, int8_t *mp, int64_t mpsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
DEVICE ALWAYS_INLINE Point2D coord(const int8_t *data, const int32_t x_index, const int32_t ic, const int32_t isr, const int32_t osr)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkb__GeoMultiPoint__cpu_(RowFunctionManager &mgr, GeoMultiPoint &p)
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
DEVICE int8_t * getLineStringSizes()
DEVICE ALWAYS_INLINE CoordData trim_linestring_to_buffered_box(int8_t *l1, int64_t l1size, int32_t ic1, int32_t isr1, double *bounds2, int64_t bounds2_size, int32_t isr2, int32_t osr, double distance)
DEVICE double max_distance_point_line(double px, double py, double l1x, double l1y, double l2x, double l2y)
EXTENSION_NOINLINE bool Point_Overlaps_Box(double *bounds, int64_t bounds_size, double px, double py)
EXTENSION_INLINE double ST_Distance_Polygon_MultiPoint(int8_t *poly, int64_t polysize, int32_t *poly_ring_sizes, int64_t poly_num_rings, int8_t *mp, int64_t mpsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_NOINLINE void ST_Centroid_MultiPoint(int8_t *mp, int32_t mpsize, int32_t ic, int32_t isr, int32_t osr, double *multipoint_centroid)
Simplified core of GeoJSON MultiPolygon coordinates definition.
EXTENSION_INLINE double ST_Distance_MultiLineString_Point(int8_t *mls, int64_t mls_size, int32_t *mls_ls_sizes, int64_t mls_ls_num, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_INLINE bool ST_cIntersects_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 ALWAYS_INLINE Point2D conv_4326_900913(const Point2D point)
DEVICE ALWAYS_INLINE double 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, double threshold)
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, double threshold)
EXTENSION_NOINLINE void ST_Centroid_Polygon(int8_t *poly_coords, int32_t poly_coords_size, int32_t *poly_ring_sizes, int32_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr, double *poly_centroid)
EXTENSION_NOINLINE TextEncodingNone ST_AsBinary__GeoMultiPolygon__cpu_(RowFunctionManager &mgr, GeoMultiPolygon &mp)
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, double threshold)
EXTENSION_NOINLINE TextEncodingNone ST_AsText__GeoPoint__cpu_(RowFunctionManager &mgr, GeoPoint &p)
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 ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
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, double threshold)
EXTENSION_NOINLINE double ST_MaxDistance_Point_LineString(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE bool ST_Contains_Polygon_Point(const int8_t *poly_coords, const int64_t poly_coords_size, const int32_t *poly_ring_sizes, const int64_t poly_num_rings, const double *poly_bounds, const int64_t poly_bounds_size, const int8_t *p, const int64_t psize, const int32_t ic1, const int32_t isr1, const int32_t ic2, const int32_t isr2, const int32_t osr)
DEVICE ALWAYS_INLINE int16_t orientation(double px, double py, double qx, double qy, double rx, double ry)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkt__GeoLineString__cpu_(RowFunctionManager &mgr, GeoLineString &p)
DEVICE double distance_line_line_squared(double l11x, double l11y, double l12x, double l12y, double l21x, double l21y, double l22x, double l22y)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkt__GeoMultiPoint__cpu_(RowFunctionManager &mgr, GeoMultiPoint &p)
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 ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_NOINLINE double ST_YMin(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_Point_MultiPoint(int8_t *p, int64_t psize, int8_t *mp, int64_t mpsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
DEVICE ALWAYS_INLINE double area_ring(int8_t *ring, int64_t ringsize, int32_t ic, int32_t isr, int32_t osr)
EXTENSION_INLINE bool ST_DWithin_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, double distance_within)
EXTENSION_INLINE double ST_Distance_LineString_Point(int8_t *l, int64_t lsize, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_INLINE bool ST_Contains_LineString_Point(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_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_cContains_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_NOINLINE TextEncodingNone ST_AsWkt__GeoPoint__cpu_(RowFunctionManager &mgr, GeoPoint &p)
EXTENSION_NOINLINE TextEncodingNone ST_AsBinary__GeoLineString__cpu_(RowFunctionManager &mgr, GeoLineString &l)
DEVICE ALWAYS_INLINE bool box_overlaps_box(double *bounds1, int64_t bounds1_size, double *bounds2, int64_t bounds2_size)
DEVICE bool is_utm_srid(unsigned const srid)
DEVICE int32_t getInputSrid() const
DEVICE int32_t getCompression() const
EXTENSION_NOINLINE void ST_Centroid_Point(int8_t *p, int32_t psize, int32_t ic, int32_t isr, int32_t osr, double *point_centroid)
EXTENSION_NOINLINE void ST_Centroid_MultiPolygon(int8_t *mpoly_coords, int32_t mpoly_coords_size, int32_t *mpoly_ring_sizes, int32_t mpoly_num_rings, int32_t *mpoly_poly_sizes, int32_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr, double *mpoly_centroid)
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)
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, double threshold)
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)
DEVICE int32_t getSize() const
#define TOLERANCE_DEFAULT
DEVICE ALWAYS_INLINE bool x_and_y_are_dependent(const int32_t isr, const int32_t osr)
EXTENSION_NOINLINE TextEncodingNone ST_AsText__GeoMultiPoint__cpu_(RowFunctionManager &mgr, GeoMultiPoint &mp)
EXTENSION_NOINLINE double ST_Distance_LineString_Polygon(int8_t *l, int64_t lsize, 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, double threshold)
DEVICE bool line_intersects_line(double l11x, double l11y, double l12x, double l12y, double l21x, double l21y, double l22x, double l22y)
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 ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE ALWAYS_INLINE Point2D conv_4326_utm(const Point2D point, const int32_t utm_srid)
EXTENSION_NOINLINE double ST_Length_MultiLineString(int8_t *coords, int64_t coords_sz, int8_t *linestring_sizes_in, int64_t linestring_sizes_sz, 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)
EXTENSION_NOINLINE double ST_Distance_LineString_MultiPolygon(int8_t *l, int64_t lsize, 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, double threshold)
EXTENSION_NOINLINE double ST_MaxDistance_LineString_Point(int8_t *l, int64_t lsize, 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 tol_zero_template(const T x, const T tolerance=TOLERANCE_DEFAULT)
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_LineString_MultiPoint(int8_t *l, int64_t lsize, int8_t *mp, int64_t mpsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
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 ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_INLINE bool ST_DWithin_Point_LineString(int8_t *p1, int64_t p1size, int8_t *l2, int64_t l2size, double *l2bounds, int64_t l2bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double distance_within)
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 ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
DEVICE int32_t getCompression() const
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 TextEncodingNone ST_AsBinary__GeoPoint__cpu_(RowFunctionManager &mgr, GeoPoint &p)
Convert to/from WGS84 (long,lat) and UTM (x,y) given utm zone srid.
EXTENSION_NOINLINE TextEncodingNone ST_AsWkt__GeoMultiPolygon__cpu_(RowFunctionManager &mgr, GeoMultiPolygon &p)
DEVICE int32_t getOutputSrid() const
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)
DEVICE ALWAYS_INLINE bool box_contains_point(const double *bounds, const int64_t bounds_size, const double px, const double py)
EXTENSION_NOINLINE TextEncodingNone ST_AsText__GeoMultiPolygon__cpu_(RowFunctionManager &mgr, GeoMultiPolygon &mp)
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, double threshold)
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)
DEVICE ALWAYS_INLINE Point2D transform_point(const Point2D point, const int32_t isr, const 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_NOINLINE double ST_Perimeter_MultiPolygon_Geodesic(int8_t *mpoly_coords, int32_t mpoly_coords_size, int8_t *mpoly_ring_sizes, int32_t mpoly_num_rings, int8_t *mpoly_poly_sizes, int32_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE bool tol_le(const double x, const double y, const double tolerance=TOLERANCE_DEFAULT)
std::shared_ptr< std::vector< double > > decompress_coords< double, int32_t >(const int32_t &ic, const int8_t *coords, const size_t coords_sz)
DEVICE ALWAYS_INLINE bool centroid_add_segment(double x1, double y1, double x2, double y2, double *length, double *linestring_centroid_sum)
EXTENSION_INLINE bool ST_DWithin_LineString_LineString(int8_t *l1, int64_t l1size, double *l1bounds, int64_t l1bounds_size, int8_t *l2, int64_t l2size, double *l2bounds, int64_t l2bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double distance_within)
DEVICE int32_t getInputSrid() const
DEVICE ALWAYS_INLINE bool tol_zero(const double x, const double tolerance=TOLERANCE_DEFAULT)
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 bool ST_Intersects_LineString_Linestring(int8_t *l1, int64_t l1size, double *l1bounds, int64_t l1bounds_size, int8_t *l2, int64_t l2size, double *l2bounds, int64_t l2bounds_size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
ALWAYS_INLINE std::string __wkb_to_str(T &geometry)
DEVICE ALWAYS_INLINE double distance_point_point_squared(double p1x, double p1y, double p2x, double p2y)
DEVICE ALWAYS_INLINE double distance_point_linestring(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, bool check_closed, double threshold)
EXTENSION_NOINLINE double ST_Area_MultiPolygon(int8_t *mpoly_coords, int32_t mpoly_coords_size, int8_t *mpoly_ring_sizes, int32_t mpoly_num_rings, int8_t *mpoly_poly_sizes_in, int32_t mpoly_num_polys, int32_t ic, int32_t isr, int32_t osr)
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_NOINLINE TextEncodingNone ST_AsBinary__GeoMultiPoint__cpu_(RowFunctionManager &mgr, GeoMultiPoint &mp)
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)
DEVICE int32_t getCompression() const
EXTENSION_NOINLINE double ST_Perimeter_Polygon(int8_t *poly, int32_t polysize, int8_t *poly_ring_sizes, int32_t poly_num_rings, int32_t ic, int32_t isr, 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 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)
DEVICE ALWAYS_INLINE double 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, double threshold)
Geospatial::GeoPolygon to_Geospatial_GeoPolygon(GeoPolygon &p)
DEVICE ALWAYS_INLINE bool tol_ge(const double x, const double y, const double tolerance=TOLERANCE_DEFAULT)
DEVICE ALWAYS_INLINE bool polygon_contains_point(const int8_t *poly, const int32_t poly_num_coords, const double px, const double py, const int32_t ic1, const int32_t isr1, const int32_t osr)
DEVICE ALWAYS_INLINE int32_t compression_unit_size(const int32_t ic)
EXTENSION_NOINLINE TextEncodingNone ST_AsBinary__GeoPolygon__cpu_(RowFunctionManager &mgr, GeoPolygon &p)
EXTENSION_NOINLINE TextEncodingNone ST_AsBinary__GeoMultiLineString__cpu_(RowFunctionManager &mgr, GeoMultiLineString &ml)
std::string getWktString() const
DEVICE ALWAYS_INLINE Point2D get_point(const int8_t *data, const int32_t x_index, const int32_t ic, const int32_t isr, const int32_t osr)
EXTENSION_INLINE bool ST_cIntersects_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)
#define TOLERANCE_DEFAULT_SQUARED
EXTENSION_INLINE bool ST_Intersects_LineString_Point(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_size, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE TextEncodingNone ST_AsText__GeoLineString__cpu_(RowFunctionManager &mgr, GeoLineString &l)
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, double threshold)
EXTENSION_NOINLINE double ST_Distance_Point_ClosedLineString(int8_t *p, int64_t psize, int8_t *l, int64_t lsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_NOINLINE double ST_Area_Polygon(int8_t *poly_coords, int32_t poly_coords_size, int8_t *poly_ring_sizes, int32_t poly_num_rings, int32_t ic, int32_t isr, 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)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkb__GeoPolygon__cpu_(RowFunctionManager &mgr, GeoPolygon &p)
DEVICE ALWAYS_INLINE bool point_in_polygon_winding_number(const int8_t *poly, const int32_t poly_num_coords, const T px, const T py, const int32_t ic1, const int32_t isr1, const int32_t osr)
EXTENSION_NOINLINE TextEncodingNone ST_AsWkt__GeoPolygon__cpu_(RowFunctionManager &mgr, GeoPolygon &p)
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, double threshold)
DEVICE double distance_point_line_squared(double px, double py, double l1x, double l1y, double l2x, double l2y)
#define COMPRESSION_GEOINT32
EXTENSION_NOINLINE double ST_Perimeter_Polygon_Geodesic(int8_t *poly, int32_t polysize, int8_t *poly_ring_sizes_in, int32_t poly_num_rings, int32_t ic, int32_t isr, int32_t osr)
DEVICE int32_t getInputSrid() const
DEVICE ALWAYS_INLINE double tol(int32_t ic)
EXTENSION_INLINE bool ST_DWithin_LineString_Polygon(int8_t *l1, int64_t l1size, double *l1bounds, int64_t l1bounds_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, double distance_within)
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 bool ST_Contains_LineString_Polygon(int8_t *l, int64_t lsize, double *lbounds, int64_t lbounds_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 bool Contains_Polygon_Point_Impl(const int8_t *poly_coords, const int64_t poly_coords_size, const int32_t *poly_ring_sizes, const int64_t poly_num_rings, const double *poly_bounds, const int64_t poly_bounds_size, const int8_t *p, const int64_t psize, const int32_t ic1, const int32_t isr1, const int32_t ic2, const int32_t isr2, const int32_t osr)
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)
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, double threshold)
EXTENSION_INLINE double ST_Distance_MultiPoint_LineString(int8_t *mp, int64_t mpsize, int8_t *l, int64_t lsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
DEVICE int32_t getOutputSrid() const
EXTENSION_NOINLINE double conv_4326_900913_y(const double y)
EXTENSION_INLINE bool ST_DWithin_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, double distance_within)
EXTENSION_NOINLINE double conv_4326_900913_x(const double x)
DEVICE ALWAYS_INLINE bool tol_eq(const double x, const double y, const double tolerance=TOLERANCE_DEFAULT)
DEVICE ALWAYS_INLINE bool box_contains_box_vertex(double *bounds1, int64_t bounds1_size, double *bounds2, int64_t bounds2_size)
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 ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
DEVICE ALWAYS_INLINE bool box_contains_box(double *bounds1, int64_t bounds1_size, double *bounds2, int64_t bounds2_size)
DEVICE ALWAYS_INLINE bool point_dwithin_box(int8_t *p1, int64_t p1size, int32_t ic1, int32_t isr1, double *bounds2, int64_t bounds2_size, int32_t isr2, int32_t osr, double distance)
EXTENSION_INLINE double ST_YMax_Bounds(double *bounds, int64_t size, int32_t isr, int32_t osr)
EXTENSION_NOINLINE void ST_Centroid_LineString(int8_t *coords, int32_t coords_sz, int32_t ic, int32_t isr, int32_t osr, double *linestring_centroid)
EXTENSION_INLINE double ST_XMax_Bounds(double *bounds, int64_t size, int32_t isr, int32_t osr)
DEVICE ALWAYS_INLINE double decompress_coord(const int8_t *data, const int32_t x_index, const int32_t ic)
Geospatial::GeoMultiPolygon to_Geospatial_GeoMultiPolygon(GeoMultiPolygon &mp)
EXTENSION_NOINLINE double ST_Distance_Point_MultiLineString(int8_t *p, int64_t psize, int8_t *mls, int64_t mls_size, int32_t *mls_ls_sizes, int64_t mls_ls_num, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_INLINE bool ST_DWithin_LineString_MultiPolygon(int8_t *l1, int64_t l1size, double *l1bounds, int64_t l1bounds_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, double distance_within)
DEVICE int32_t getOutputSrid() const
EXTENSION_INLINE bool ST_DWithin_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, double distance_within)
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 ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr)
EXTENSION_NOINLINE double ST_Distance_MultiPoint_MultiPoint(int8_t *mp1, int64_t mp1size, int8_t *mp2, int64_t mp2size, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_INLINE double ST_Distance_MultiLineString_MultiPoint(int8_t *mls, int64_t mls_size, int32_t *mls_ls_sizes, int64_t mls_ls_num, int8_t *mp, int64_t mpsize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
EXTENSION_INLINE double ST_Distance_MultiPoint_Point(int8_t *mp, int64_t mpsize, int8_t *p, int64_t psize, int32_t ic1, int32_t isr1, int32_t ic2, int32_t isr2, int32_t osr, double threshold)
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)