95 double x1, x2, y1, y2;
97 double initdistance = (mode ==
DIST_MIN ? FLT_MAX : -1.0);
106 LWDEBUG(2,
"lw_dist2d_distanceline is called");
111 lwerror(
"Some unspecified error.");
118 LWDEBUG(3,
"didn't find geometries to measure between, returning null");
144 double initdistance = FLT_MAX;
151 LWDEBUG(2,
"lw_dist2d_distancepoint is called");
156 lwerror(
"Some unspecified error.");
161 LWDEBUG(3,
"didn't find geometries to measure between, returning null");
179 LWDEBUG(2,
"lwgeom_maxdistance2d is called");
193 LWDEBUG(2,
"lwgeom_maxdistance2d_tolerance is called");
201 lwerror(
"Some unspecified error.");
222 LWDEBUG(2,
"lwgeom_mindistance2d_tolerance is called");
229 lwerror(
"Some unspecified error.");
290 LWDEBUGF(2,
"lw_dist2d_comp is called with type1=%d, type2=%d", lwg1->
type, lwg2->
type);
294 LWDEBUG(3,
"First geometry is collection");
300 LWDEBUG(3,
"Second geometry is collection");
305 for (i = 0; i < n1; i++)
318 LWDEBUG(3,
"Found collection inside first geometry collection, recursing");
323 for (j = 0; j < n2; j++)
332 LWDEBUG(3,
"Found collection inside second geometry collection, recursing");
531 LWDEBUG(2,
"lw_dist2d_check_overlap is called");
541 LWDEBUG(3,
"geometries bboxes did not overlap");
544 LWDEBUG(3,
"geometries bboxes overlap");
553 int type1 = lwg1->
type;
554 int type2 = lwg2->
type;
556 LWDEBUGF(2,
"lw_dist2d_distribute_fast is called with typ1=%d, type2=%d", lwg1->
type, lwg2->
type);
561 pa1 = ((
LWLINE *)lwg1)->points;
564 pa1 = ((
LWPOLY *)lwg1)->rings[0];
576 pa2 = ((
LWLINE *)lwg2)->points;
579 pa2 = ((
LWPOLY *)lwg2)->rings[0];
669 for (uint32_t i = 1; i < poly->
nrings; i++)
684 lwerror(
"lw_dist2d_point_curvepoly cannot calculate max distance");
694 for (uint32_t i = 1; i < poly->
nrings; i++)
752 for (uint32_t i = 1; i < poly->
nrings; i++)
763 for (uint32_t i = 1; i < poly->
nrings; i++)
784 for (uint32_t i = 1; i < poly->
nrings; i++)
795 for (uint32_t i = 1; i < poly->
nrings; i++)
858 for (uint32_t i = 1; i < poly->
nrings; i++)
869 for (uint32_t i = 1; i < poly->
nrings; i++)
893 lwerror(
"lw_curvering_getfirstpoint2d_cp: unknown type");
920 for (uint32_t i = 1; i < poly->
nrings; i++)
931 for (uint32_t i = 1; i < poly->
nrings; i++)
967 LWDEBUG(2,
"lw_dist2d_poly_poly called");
987 for (uint32_t i = 1; i < poly1->
nrings; i++)
994 for (uint32_t i = 1; i < poly2->
nrings; i++)
1014 lwerror(
"Unspecified error in function lw_dist2d_poly_poly");
1071 for (uint32_t i = 1; i < poly1->
nrings; i++)
1078 for (uint32_t i = 1; i < poly2->
nrings; i++)
1098 lwerror(
"Unspecified error in function lw_dist2d_curvepoly_curvepoly");
1117 for (uint32_t t = 1; t < pa->
npoints; t++)
1145 LWDEBUG(2,
"lw_dist2d_pt_ptarrayarc is called");
1149 lwerror(
"lw_dist2d_pt_ptarrayarc called with non-arc input");
1155 lwerror(
"lw_dist2d_pt_ptarrayarc does not currently support DIST_MAX mode");
1164 for (t = 1; t < pa->
npoints; t += 2)
1199 for (t = 0; t < l1->
npoints; t++)
1202 for (u = 0; u < l2->
npoints; u++)
1212 for (t = 1; t < l1->
npoints; t++)
1216 for (u = 1; u < l2->
npoints; u++)
1249 lwerror(
"lw_dist2d_ptarray_ptarrayarc called with non-arc input");
1255 lwerror(
"lw_dist2d_ptarray_ptarrayarc does not currently support DIST_MAX mode");
1261 for (t = 1; t < pa->
npoints; t++)
1265 for (u = 1; u < pb->
npoints; u += 2)
1304 lwerror(
"lw_dist2d_ptarrayarc_ptarrayarc does not currently support DIST_MAX mode");
1310 for (t = 1; t < pa->
npoints; t += 2)
1315 for (u = 1; u < pb->
npoints; u += 2)
1351 int pt_in_arc, pt_in_seg;
1356 lwerror(
"lw_dist2d_seg_arc does not support maxdistance mode");
1372 lwerror(
"lw_dist2d_pt_seg failed in lw_dist2d_seg_arc");
1380 if (dist_C_D < radius_C)
1386 dist_D_EF = sqrt(radius_C * radius_C - dist_C_D * dist_C_D);
1387 length_A = sqrt((A2->
x - A1->
x) * (A2->
x - A1->
x) + (A2->
y - A1->
y) * (A2->
y - A1->
y));
1390 E.
x = D.
x - (A2->
x - A1->
x) * dist_D_EF / length_A;
1391 E.
y = D.
y - (A2->
y - A1->
y) * dist_D_EF / length_A;
1393 F.
x = D.
x + (A2->
x - A1->
x) * dist_D_EF / length_A;
1394 F.
y = D.
y + (A2->
y - A1->
y) * dist_D_EF / length_A;
1400 if (pt_in_arc && pt_in_seg)
1410 if (pt_in_arc && pt_in_seg)
1420 else if (dist_C_D == radius_C)
1427 if (pt_in_arc && pt_in_seg)
1439 G.
x = C.
x + (D.
x - C.
x) * radius_C / dist_C_D;
1440 G.
y = C.
y + (D.
y - C.
y) * radius_C / dist_C_D;
1446 if (pt_in_arc && pt_in_seg)
1457 if (pt_in_arc && !pt_in_seg)
1464 else if (pt_in_seg && !pt_in_arc)
1491 lwerror(
"lw_dist2d_pt_arc does not support maxdistance mode");
1515 X.
x = C.
x + (P->
x - C.
x) * radius_A / d;
1516 X.
y = C.
y + (P->
y - C.
y) * radius_A / d;
1554 double radius_A, radius_B, d;
1556 int pt_in_arc_A, pt_in_arc_B;
1559 lwerror(
"lw_dist2d_arc_arc only supports mindistance");
1576 if (radius_A < 0 && radius_B < 0)
1595 if (radius_B > radius_A)
1613 radius_B = radius_A;
1618 if (d == (radius_A + radius_B))
1620 D.
x = CA.
x + (CB.
x - CA.
x) * radius_A / d;
1621 D.
y = CA.
y + (CB.
y - CA.
y) * radius_A / d;
1627 if (pt_in_arc_A && pt_in_arc_B)
1635 else if (d > (radius_A + radius_B) || d < (radius_A - radius_B) )
1642 XA.
x = CA.
x + (CB.
x - CA.
x) * radius_A / d;
1643 XA.
y = CA.
y + (CB.
y - CA.
y) * radius_A / d;
1644 XB.
x = CB.
x + (CA.
x - CB.
x) * radius_B / d;
1645 XB.
y = CB.
y + (CA.
y - CB.
y) * radius_B / d;
1652 if (pt_in_arc_A && pt_in_arc_B)
1659 else if (d < (radius_A + radius_B))
1663 double a = (radius_A * radius_A - radius_B * radius_B + d * d) / (2 * d);
1665 double h = sqrt(radius_A * radius_A - a * a);
1668 D.
x = CA.
x + (CB.
x - CA.
x) * a / d;
1669 D.
y = CA.
y + (CB.
y - CA.
y) * a / d;
1672 E.
x = D.
x + (D.
y - CA.
y) * h / a;
1673 E.
y = D.
y + (D.
x - CA.
x) * h / a;
1679 if (pt_in_arc_A && pt_in_arc_B)
1686 F.
x = D.
x - (D.
y - CA.
y) * h / a;
1687 F.
y = D.
y - (D.
x - CA.
x) * h / a;
1693 if (pt_in_arc_A && pt_in_arc_B)
1701 lwerror(
"lw_dist2d_arc_arc: arcs neither touch, intersect nor are disjoint! INCONCEIVABLE!");
1707 if (pt_in_arc_A && !pt_in_arc_B)
1715 else if (pt_in_arc_B && !pt_in_arc_A)
1747 double dist_sqr, shortest_sqr;
1752 if (radius_A == radius_B)
1785 proj.
x = CENTER->
x + (B1->
x - CENTER->
x) * radius_A / radius_B;
1786 proj.
y = CENTER->
y + (B1->
y - CENTER->
y) * radius_A / radius_B;
1794 proj.
x = CENTER->
x + (B3->
x - CENTER->
x) * radius_A / radius_B;
1795 proj.
y = CENTER->
y + (B3->
y - CENTER->
y) * radius_A / radius_B;
1806 proj.
x = CENTER->
x + (A1->
x - CENTER->
x) * radius_B / radius_A;
1807 proj.
y = CENTER->
y + (A1->
y - CENTER->
y) * radius_B / radius_A;
1815 proj.
x = CENTER->
x + (A3->
x - CENTER->
x) * radius_B / radius_A;
1816 proj.
y = CENTER->
y + (A3->
y - CENTER->
y) * radius_B / radius_A;
1830 if (dist_sqr < shortest_sqr)
1832 shortest_sqr = dist_sqr;
1838 if (dist_sqr < shortest_sqr)
1840 shortest_sqr = dist_sqr;
1846 if (dist_sqr < shortest_sqr)
1848 shortest_sqr = dist_sqr;
1865 double s_top, s_bot,
s;
1866 double r_top, r_bot,
r;
1869 if ((A->
x == B->
x) && (A->
y == B->
y))
1875 if ((C->
x == D->
x) && (C->
y == D->
y))
1903 r_top = (A->
y - C->
y) * (D->
x - C->
x) - (A->
x - C->
x) * (D->
y - C->
y);
1904 r_bot = (B->
x - A->
x) * (D->
y - C->
y) - (B->
y - A->
y) * (D->
x - C->
x);
1906 s_top = (A->
y - C->
y) * (B->
x - A->
x) - (A->
x - C->
x) * (B->
y - A->
y);
1907 s_bot = (B->
x - A->
x) * (D->
y - C->
y) - (B->
y - A->
y) * (D->
x - C->
x);
1909 if ((r_bot == 0) || (s_bot == 0))
1943 if (((A->
x == C->
x) && (A->
y == C->
y)) || ((A->
x == D->
x) && (A->
y == D->
y)))
1948 else if (((B->
x == C->
x) && (B->
y == C->
y)) || ((B->
x == D->
x) && (B->
y == D->
y)))
1955 theP.
x = A->
x +
r * (B->
x - A->
x);
1956 theP.
y = A->
y +
r * (B->
y - A->
y);
1985 float deltaX, deltaY, c1m, c2m;
1988 float min1X, max1X, max1Y, min1Y, min2X, max2X, max2Y, min2Y;
1997 LWDEBUG(2,
"lw_dist2d_fast_ptarray_ptarray is called");
2008 c1.
x = min1X + (max1X - min1X) / 2;
2009 c1.
y = min1Y + (max1Y - min1Y) / 2;
2010 c2.
x = min2X + (max2X - min2X) / 2;
2011 c2.
y = min2Y + (max2Y - min2Y) / 2;
2013 deltaX = (c2.
x - c1.
x);
2014 deltaY = (c2.
y - c1.
y);
2019 if ((deltaX * deltaX) < (deltaY * deltaY))
2021 k = -deltaX / deltaY;
2022 for (t = 0; t < n1; t++)
2025 thevalue = theP->
y - (k * theP->
x);
2029 for (t = 0; t < n2; t++)
2032 thevalue = theP->
y - (k * theP->
x);
2036 c1m = c1.
y - (k * c1.
x);
2037 c2m = c2.
y - (k * c2.
x);
2045 k = -deltaY / deltaX;
2046 for (t = 0; t < n1; t++)
2049 thevalue = theP->
x - (k * theP->
y);
2054 for (t = 0; t < n2; t++)
2057 thevalue = theP->
x - (k * theP->
y);
2062 c1m = c1.
x - (k * c1.
y);
2063 c2m = c2.
x - (k * c2.
y);
2106 const POINT2D *p1, *p2, *p3, *p4, *p01, *p02;
2107 int pnr1, pnr2, pnr3, pnr4, n1, n2, i, u,
r, twist;
2112 LWDEBUG(2,
"lw_dist2d_pre_seg_seg is called");
2119 for (i = (n1 - 1); i >= 0; --i)
2123 if (((list2[0].themeasure - list1[i].themeasure)) > maxmeasure)
2127 for (
r = -1;
r <= 1;
r += 2)
2129 pnr1 = list1[i].
pnr;
2134 if ((p1->
x == p01->
x) && (p1->
y == p01->
y))
2141 else if (pnr1 +
r > (n1 - 1))
2144 if ((p1->
x == p01->
x) && (p1->
y == p01->
y))
2154 for (u = 0; u < n2; ++u)
2156 if (((list2[u].themeasure - list1[i].themeasure)) >= maxmeasure)
2158 pnr3 = list2[u].
pnr;
2163 if ((p3->
x == p02->
x) && (p3->
y == p02->
y))
2177 if (pnr3 >= (n2 - 1))
2180 if ((p3->
x == p02->
x) && (p3->
y == p02->
y))
2212 if ((A->
x == B->
x) && (A->
y == B->
y))
2218 if ((C->
x == D->
x) && (C->
y == D->
y))
2255 if ((A->
x == B->
x) && (A->
y == B->
y))
2273 r = ((p->
x - A->
x) * (B->
x - A->
x) + (p->
y - A->
y) * (B->
y - A->
y)) /
2274 ((B->
x - A->
x) * (B->
x - A->
x) + (B->
y - A->
y) * (B->
y - A->
y));
2292 if ((((A->
y - p->
y) * (B->
x - A->
x) == (A->
x - p->
x) * (B->
y - A->
y))) && (dl->
mode ==
DIST_MIN))
2299 c.
x = A->
x +
r * (B->
x - A->
x);
2300 c.
y = A->
y +
r * (B->
y - A->
y);
2310 double hside = thep2->
x - thep1->
x;
2311 double vside = thep2->
y - thep1->
y;
2312 double dist = sqrt(hside * hside + vside * vside);
2342 double hside = p2->
x - p1->
x;
2343 double vside = p2->
y - p1->
y;
2345 return hypot(hside, vside);
2353 if ((A->
x == B->
x) && (A->
y == B->
y))
2371 double ba_x = (B->
x - A->
x);
2372 double ba_y = (B->
y - A->
y);
2373 double ab_length_sqr = (ba_x * ba_x + ba_y * ba_y);
2374 double ca_x = (C->
x - A->
x);
2375 double ca_y = (C->
y - A->
y);
2376 double dot_ac_ab = (ca_x * ba_x + ca_y * ba_y);
2380 if (dot_ac_ab >= ab_length_sqr)
2393 double s_numerator = ca_x * ba_y - ca_y * ba_x;
2396 return s_numerator * s_numerator / ab_length_sqr;
2406 if (A->
x == B->
x && A->
y == B->
y)
2408 *d = fmod(2 * M_PI + M_PI / 2 - atan2(B->
y - A->
y, B->
x - A->
x), 2 * M_PI);
char result[OUT_DOUBLE_BUFFER_SIZE]
LWPOINT * lwpoint_make2d(int32_t srid, double x, double y)
LWLINE * lwline_from_ptarray(int32_t srid, uint32_t npoints, LWPOINT **points)
void lwgeom_free(LWGEOM *geom)
LWCURVEPOLY * lwcurvepoly_construct_from_lwpoly(LWPOLY *lwpoly)
Construct an equivalent curve polygon from a polygon.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
#define POLYHEDRALSURFACETYPE
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate bounding box of a geometry, automatically taking into account whether it is cartesian or ge...
void * lwalloc(size_t size)
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
#define LW_TRUE
Return types for functions with status returns.
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
#define LW_INSIDE
Constants for point-in-polygon return values.
double lw_arc_center(const POINT2D *p1, const POINT2D *p2, const POINT2D *p3, POINT2D *result)
Determines the center of the circle defined by the three given points.
int ptarray_contains_point(const POINTARRAY *pa, const POINT2D *pt)
Return 1 if the point is inside the POINTARRAY, -1 if it is outside, and 0 if it is on the boundary.
int lw_pt_in_seg(const POINT2D *P, const POINT2D *A1, const POINT2D *A2)
Returns true if P is between A1/A2.
int lwgeom_contains_point(const LWGEOM *geom, const POINT2D *pt)
int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q)
lw_segment_side()
int lw_arc_is_pt(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3)
Returns true if arc A is actually a point (all vertices are the same) .
int lw_pt_in_arc(const POINT2D *P, const POINT2D *A1, const POINT2D *A2, const POINT2D *A3)
Returns true if P is on the same side of the plane partition defined by A1/A3 as A2 is.
int p2d_same(const POINT2D *p1, const POINT2D *p2)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static double distance2d_sqr_pt_pt(const POINT2D *p1, const POINT2D *p2)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static double distance(double x1, double y1, double x2, double y2)
int lw_dist2d_circstring_curvepoly(LWCIRCSTRING *circ, LWCURVEPOLY *poly, DISTPTS *dl)
int struct_cmp_by_measure(const void *a, const void *b)
int lw_dist2d_line_curvepoly(LWLINE *line, LWCURVEPOLY *poly, DISTPTS *dl)
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
LWGEOM * lwgeom_closest_point(const LWGEOM *lw1, const LWGEOM *lw2)
double lwgeom_maxdistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing max distance calculation.
int lw_dist2d_line_circstring(LWLINE *line1, LWCIRCSTRING *line2, DISTPTS *dl)
int lw_dist2d_poly_poly(LWPOLY *poly1, LWPOLY *poly2, DISTPTS *dl)
Function handling polygon to polygon calculation 1 if we are looking for maxdistance,...
LWGEOM * lw_dist2d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode)
Function initializing shortestline and longestline calculations.
int lw_dist2d_comp(const LWGEOM *lw1, const LWGEOM *lw2, DISTPTS *dl)
This function just deserializes geometries Bboxes is not checked here since it is the subgeometries b...
int lw_dist2d_pt_arc(const POINT2D *P, const POINT2D *A1, const POINT2D *A2, const POINT2D *A3, DISTPTS *dl)
static void lw_dist2d_distpts_set(DISTPTS *dl, double distance, const POINT2D *p1, const POINT2D *p2)
int lw_dist2d_pre_seg_seg(POINTARRAY *l1, POINTARRAY *l2, LISTSTRUCT *list1, LISTSTRUCT *list2, double k, DISTPTS *dl)
preparation before lw_dist2d_seg_seg.
int azimuth_pt_pt(const POINT2D *A, const POINT2D *B, double *d)
Compute the azimuth of segment AB in radians.
int lw_dist2d_point_curvepoly(LWPOINT *point, LWCURVEPOLY *poly, DISTPTS *dl)
int lw_dist2d_point_circstring(LWPOINT *point, LWCIRCSTRING *circ, DISTPTS *dl)
int lw_dist2d_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B, DISTPTS *dl)
lw_dist2d_comp from p to line A->B This one is now sending every occasion to lw_dist2d_pt_pt Before i...
int lw_dist2d_circstring_poly(LWCIRCSTRING *circ, LWPOLY *poly, DISTPTS *dl)
int lw_dist2d_tri_circstring(LWTRIANGLE *tri, LWCIRCSTRING *line, DISTPTS *dl)
LWGEOM * lwgeom_furthest_point(const LWGEOM *lw1, const LWGEOM *lw2)
int lw_dist2d_arc_arc_concentric(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3, double radius_A, const POINT2D *B1, const POINT2D *B2, const POINT2D *B3, double radius_B, const POINT2D *CENTER, DISTPTS *dl)
int lw_dist2d_line_tri(LWLINE *line, LWTRIANGLE *tri, DISTPTS *dl)
int lw_dist2d_pt_ptarray(const POINT2D *p, POINTARRAY *pa, DISTPTS *dl)
search all the segments of pointarray to see which one is closest to p1 Returns minimum distance betw...
int lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
This is a recursive function delivering every possible combination of subgeometries.
int lw_dist2d_seg_seg(const POINT2D *A, const POINT2D *B, const POINT2D *C, const POINT2D *D, DISTPTS *dl)
Finds the shortest distance between two segments.
int lw_dist2d_curvepoly_curvepoly(LWCURVEPOLY *poly1, LWCURVEPOLY *poly2, DISTPTS *dl)
int lw_dist2d_poly_curvepoly(LWPOLY *poly1, LWCURVEPOLY *curvepoly2, DISTPTS *dl)
int lw_dist2d_seg_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *B1, const POINT2D *B2, const POINT2D *B3, DISTPTS *dl)
Calculate the shortest distance between an arc and an edge.
int lw_dist2d_point_line(LWPOINT *point, LWLINE *line, DISTPTS *dl)
point to line calculation
int lw_dist2d_tri_curvepoly(LWTRIANGLE *tri, LWCURVEPOLY *poly, DISTPTS *dl)
double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling min distance calculations and dwithin calculations.
void lw_dist2d_distpts_init(DISTPTS *dl, int mode)
int lw_dist2d_fast_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS *dl, GBOX *box1, GBOX *box2)
The new faster calculation comparing pointarray to another pointarray the arrays can come from both p...
static int lw_dist2d_is_collection(const LWGEOM *g)
int lw_dist2d_arc_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3, const POINT2D *B1, const POINT2D *B2, const POINT2D *B3, DISTPTS *dl)
int lw_dist2d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS *dl)
LWGEOM * lwgeom_closest_line(const LWGEOM *lw1, const LWGEOM *lw2)
static const POINT2D * lw_curvering_getfirstpoint2d_cp(LWGEOM *geom)
int lw_dist2d_tri_tri(LWTRIANGLE *tri1, LWTRIANGLE *tri2, DISTPTS *dl)
int lw_dist2d_point_tri(LWPOINT *point, LWTRIANGLE *tri, DISTPTS *dl)
double lwgeom_mindistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing min distance calculation.
int lw_dist2d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS *dl)
test each segment of l1 against each segment of l2.
int lw_dist2d_ptarray_ptarrayarc(const POINTARRAY *pa, const POINTARRAY *pb, DISTPTS *dl)
Test each segment of pa against each arc of pb for distance.
int lw_dist2d_selected_seg_seg(const POINT2D *A, const POINT2D *B, const POINT2D *C, const POINT2D *D, DISTPTS *dl)
This is the same function as lw_dist2d_seg_seg but without any calculations to determine intersection...
int lw_dist2d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS *dl)
line to polygon calculation Brute force.
int lw_dist2d_distribute_bruteforce(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
int lw_dist2d_ptarrayarc_ptarrayarc(const POINTARRAY *pa, const POINTARRAY *pb, DISTPTS *dl)
Test each arc of pa against each arc of pb for distance.
LWGEOM * lwgeom_furthest_line(const LWGEOM *lw1, const LWGEOM *lw2)
double lwgeom_maxdistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling max distance calculations and dfullywithin calculations.
LWGEOM * lw_dist2d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode)
Function initializing closestpoint calculations.
double distance2d_sqr_pt_seg(const POINT2D *C, const POINT2D *A, const POINT2D *B)
int lw_dist2d_distribute_fast(LWGEOM *lwg1, LWGEOM *lwg2, DISTPTS *dl)
Geometries are distributed for the new faster distance-calculations.
int lw_dist2d_pt_pt(const POINT2D *thep1, const POINT2D *thep2, DISTPTS *dl)
Compares incoming points and stores the points closest to each other or most far away from each other...
int lw_dist2d_circstring_circstring(LWCIRCSTRING *line1, LWCIRCSTRING *line2, DISTPTS *dl)
int lw_dist2d_pt_ptarrayarc(const POINT2D *p, const POINTARRAY *pa, DISTPTS *dl)
Search all the arcs of pointarray to see which one is closest to p1 Returns minimum distance between ...
int lw_dist2d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS *dl)
int lw_dist2d_tri_poly(LWTRIANGLE *tri, LWPOLY *poly, DISTPTS *dl)
int lw_dist2d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS *dl)
point to point calculation
int lw_dist2d_check_overlap(LWGEOM *lwg1, LWGEOM *lwg2)
Structure used in distance-calculations.