83 double x1, x2, y1, y2;
85 double initdistance = (mode ==
DIST_MIN ? FLT_MAX : -1.0);
94 LWDEBUG(2,
"lw_dist2d_distanceline is called");
99 lwerror(
"Some unspecified error.");
106 LWDEBUG(3,
"didn't find geometries to measure between, returning null");
132 double initdistance = FLT_MAX;
139 LWDEBUG(2,
"lw_dist2d_distancepoint is called");
144 lwerror(
"Some unspecified error.");
149 LWDEBUG(3,
"didn't find geometries to measure between, returning null");
167 LWDEBUG(2,
"lwgeom_maxdistance2d is called");
181 LWDEBUG(2,
"lwgeom_maxdistance2d_tolerance is called");
189 lwerror(
"Some unspecified error.");
210 LWDEBUG(2,
"lwgeom_mindistance2d_tolerance is called");
217 lwerror(
"Some unspecified error.");
278 LWDEBUGF(2,
"lw_dist2d_comp is called with type1=%d, type2=%d", lwg1->
type, lwg2->
type);
282 LWDEBUG(3,
"First geometry is collection");
288 LWDEBUG(3,
"Second geometry is collection");
293 for (i = 0; i < n1; i++)
306 LWDEBUG(3,
"Found collection inside first geometry collection, recursing");
311 for (j = 0; j < n2; j++)
320 LWDEBUG(3,
"Found collection inside second geometry collection, recursing");
519 LWDEBUG(2,
"lw_dist2d_check_overlap is called");
529 LWDEBUG(3,
"geometries bboxes did not overlap");
532 LWDEBUG(3,
"geometries bboxes overlap");
541 int type1 = lwg1->
type;
542 int type2 = lwg2->
type;
544 LWDEBUGF(2,
"lw_dist2d_distribute_fast is called with typ1=%d, type2=%d", lwg1->
type, lwg2->
type);
549 pa1 = ((
LWLINE *)lwg1)->points;
552 pa1 = ((
LWPOLY *)lwg1)->rings[0];
564 pa2 = ((
LWLINE *)lwg2)->points;
567 pa2 = ((
LWPOLY *)lwg2)->rings[0];
659 for (uint32_t i = 1; i < poly->
nrings; i++)
676 lwerror(
"lw_dist2d_point_curvepoly cannot calculate max distance");
686 for (uint32_t i = 1; i < poly->
nrings; i++)
748 for (uint32_t i = 1; i < poly->
nrings; i++)
759 for (uint32_t i = 1; i < poly->
nrings; i++)
782 for (uint32_t i = 1; i < poly->
nrings; i++)
793 for (uint32_t i = 1; i < poly->
nrings; i++)
864 for (uint32_t i = 1; i < poly->
nrings; i++)
875 for (uint32_t i = 1; i < poly->
nrings; i++)
901 lwerror(
"lw_curvering_getfirstpoint2d_cp: unknown type");
930 for (uint32_t i = 1; i < poly->
nrings; i++)
941 for (uint32_t i = 1; i < poly->
nrings; i++)
981 LWDEBUG(2,
"lw_dist2d_poly_poly called");
1001 for (uint32_t i = 1; i < poly1->
nrings; i++)
1008 for (uint32_t i = 1; i < poly2->
nrings; i++)
1032 lwerror(
"Unspecified error in function lw_dist2d_poly_poly");
1089 for (uint32_t i = 1; i < poly1->
nrings; i++)
1096 for (uint32_t i = 1; i < poly2->
nrings; i++)
1120 lwerror(
"Unspecified error in function lw_dist2d_curvepoly_curvepoly");
1139 for (uint32_t t = 1; t < pa->
npoints; t++)
1167 LWDEBUG(2,
"lw_dist2d_pt_ptarrayarc is called");
1171 lwerror(
"lw_dist2d_pt_ptarrayarc called with non-arc input");
1177 lwerror(
"lw_dist2d_pt_ptarrayarc does not currently support DIST_MAX mode");
1186 for (t = 1; t < pa->
npoints; t += 2)
1221 for (t = 0; t < l1->
npoints; t++)
1224 for (u = 0; u < l2->
npoints; u++)
1234 for (t = 1; t < l1->
npoints; t++)
1238 for (u = 1; u < l2->
npoints; u++)
1271 lwerror(
"lw_dist2d_ptarray_ptarrayarc called with non-arc input");
1277 lwerror(
"lw_dist2d_ptarray_ptarrayarc does not currently support DIST_MAX mode");
1283 for (t = 1; t < pa->
npoints; t++)
1287 for (u = 1; u < pb->
npoints; u += 2)
1326 lwerror(
"lw_dist2d_ptarrayarc_ptarrayarc does not currently support DIST_MAX mode");
1332 for (t = 1; t < pa->
npoints; t += 2)
1337 for (u = 1; u < pb->
npoints; u += 2)
1373 int pt_in_arc, pt_in_seg;
1378 lwerror(
"lw_dist2d_seg_arc does not support maxdistance mode");
1394 lwerror(
"lw_dist2d_pt_seg failed in lw_dist2d_seg_arc");
1402 if (dist_C_D < radius_C)
1408 dist_D_EF = sqrt(radius_C * radius_C - dist_C_D * dist_C_D);
1409 length_A = sqrt((A2->
x - A1->
x) * (A2->
x - A1->
x) + (A2->
y - A1->
y) * (A2->
y - A1->
y));
1412 E.
x = D.
x - (A2->
x - A1->
x) * dist_D_EF / length_A;
1413 E.
y = D.
y - (A2->
y - A1->
y) * dist_D_EF / length_A;
1415 F.
x = D.
x + (A2->
x - A1->
x) * dist_D_EF / length_A;
1416 F.
y = D.
y + (A2->
y - A1->
y) * dist_D_EF / length_A;
1422 if (pt_in_arc && pt_in_seg)
1434 if (pt_in_arc && pt_in_seg)
1446 else if (dist_C_D == radius_C)
1453 if (pt_in_arc && pt_in_seg)
1467 G.
x = C.
x + (D.
x - C.
x) * radius_C / dist_C_D;
1468 G.
y = C.
y + (D.
y - C.
y) * radius_C / dist_C_D;
1474 if (pt_in_arc && pt_in_seg)
1485 if (pt_in_arc && !pt_in_seg)
1492 else if (pt_in_seg && !pt_in_arc)
1519 lwerror(
"lw_dist2d_pt_arc does not support maxdistance mode");
1545 X.
x = C.
x + (P->
x - C.
x) * radius_A / d;
1546 X.
y = C.
y + (P->
y - C.
y) * radius_A / d;
1584 double radius_A, radius_B, d;
1586 int pt_in_arc_A, pt_in_arc_B;
1589 lwerror(
"lw_dist2d_arc_arc only supports mindistance");
1606 if (radius_A < 0 && radius_B < 0)
1625 if (radius_B > radius_A)
1643 radius_B = radius_A;
1648 if (d == (radius_A + radius_B))
1650 D.
x = CA.
x + (CB.
x - CA.
x) * radius_A / d;
1651 D.
y = CA.
y + (CB.
y - CA.
y) * radius_A / d;
1657 if (pt_in_arc_A && pt_in_arc_B)
1667 else if (d > (radius_A + radius_B) || d < (radius_A - radius_B) )
1674 XA.
x = CA.
x + (CB.
x - CA.
x) * radius_A / d;
1675 XA.
y = CA.
y + (CB.
y - CA.
y) * radius_A / d;
1676 XB.
x = CB.
x + (CA.
x - CB.
x) * radius_B / d;
1677 XB.
y = CB.
y + (CA.
y - CB.
y) * radius_B / d;
1684 if (pt_in_arc_A && pt_in_arc_B)
1691 else if (d < (radius_A + radius_B))
1695 double a = (radius_A * radius_A - radius_B * radius_B + d * d) / (2 * d);
1697 double h = sqrt(radius_A * radius_A - a * a);
1700 D.
x = CA.
x + (CB.
x - CA.
x) * a / d;
1701 D.
y = CA.
y + (CB.
y - CA.
y) * a / d;
1704 E.
x = D.
x + (D.
y - CA.
y) * h / a;
1705 E.
y = D.
y + (D.
x - CA.
x) * h / a;
1711 if (pt_in_arc_A && pt_in_arc_B)
1713 dl->
p1 = dl->
p2 = E;
1719 F.
x = D.
x - (D.
y - CA.
y) * h / a;
1720 F.
y = D.
y - (D.
x - CA.
x) * h / a;
1726 if (pt_in_arc_A && pt_in_arc_B)
1728 dl->
p1 = dl->
p2 = F;
1735 lwerror(
"lw_dist2d_arc_arc: arcs neither touch, intersect nor are disjoint! INCONCEIVABLE!");
1741 if (pt_in_arc_A && !pt_in_arc_B)
1749 else if (pt_in_arc_B && !pt_in_arc_A)
1781 double dist_sqr, shortest_sqr;
1786 if (radius_A == radius_B)
1827 proj.
x = CENTER->
x + (B1->
x - CENTER->
x) * radius_A / radius_B;
1828 proj.
y = CENTER->
y + (B1->
y - CENTER->
y) * radius_A / radius_B;
1834 dl->
distance = fabs(radius_A - radius_B);
1838 proj.
x = CENTER->
x + (B3->
x - CENTER->
x) * radius_A / radius_B;
1839 proj.
y = CENTER->
y + (B3->
y - CENTER->
y) * radius_A / radius_B;
1844 dl->
distance = fabs(radius_A - radius_B);
1852 proj.
x = CENTER->
x + (A1->
x - CENTER->
x) * radius_B / radius_A;
1853 proj.
y = CENTER->
y + (A1->
y - CENTER->
y) * radius_B / radius_A;
1858 dl->
distance = fabs(radius_A - radius_B);
1863 proj.
x = CENTER->
x + (A3->
x - CENTER->
x) * radius_B / radius_A;
1864 proj.
y = CENTER->
y + (A3->
y - CENTER->
y) * radius_B / radius_A;
1869 dl->
distance = fabs(radius_A - radius_B);
1880 if (dist_sqr < shortest_sqr)
1882 shortest_sqr = dist_sqr;
1888 if (dist_sqr < shortest_sqr)
1890 shortest_sqr = dist_sqr;
1896 if (dist_sqr < shortest_sqr)
1898 shortest_sqr = dist_sqr;
1918 double s_top, s_bot,
s;
1919 double r_top, r_bot,
r;
1922 if ((A->
x == B->
x) && (A->
y == B->
y))
1928 if ((C->
x == D->
x) && (C->
y == D->
y))
1956 r_top = (A->
y - C->
y) * (D->
x - C->
x) - (A->
x - C->
x) * (D->
y - C->
y);
1957 r_bot = (B->
x - A->
x) * (D->
y - C->
y) - (B->
y - A->
y) * (D->
x - C->
x);
1959 s_top = (A->
y - C->
y) * (B->
x - A->
x) - (A->
x - C->
x) * (B->
y - A->
y);
1960 s_bot = (B->
x - A->
x) * (D->
y - C->
y) - (B->
y - A->
y) * (D->
x - C->
x);
1962 if ((r_bot == 0) || (s_bot == 0))
1996 if (((A->
x == C->
x) && (A->
y == C->
y)) || ((A->
x == D->
x) && (A->
y == D->
y)))
2001 else if (((B->
x == C->
x) && (B->
y == C->
y)) || ((B->
x == D->
x) && (B->
y == D->
y)))
2008 theP.
x = A->
x +
r * (B->
x - A->
x);
2009 theP.
y = A->
y +
r * (B->
y - A->
y);
2040 float deltaX, deltaY, c1m, c2m;
2043 float min1X, max1X, max1Y, min1Y, min2X, max2X, max2Y, min2Y;
2052 LWDEBUG(2,
"lw_dist2d_fast_ptarray_ptarray is called");
2063 c1.
x = min1X + (max1X - min1X) / 2;
2064 c1.
y = min1Y + (max1Y - min1Y) / 2;
2065 c2.
x = min2X + (max2X - min2X) / 2;
2066 c2.
y = min2Y + (max2Y - min2Y) / 2;
2068 deltaX = (c2.
x - c1.
x);
2069 deltaY = (c2.
y - c1.
y);
2074 if ((deltaX * deltaX) < (deltaY * deltaY))
2076 k = -deltaX / deltaY;
2077 for (t = 0; t < n1; t++)
2080 thevalue = theP->
y - (k * theP->
x);
2084 for (t = 0; t < n2; t++)
2087 thevalue = theP->
y - (k * theP->
x);
2091 c1m = c1.
y - (k * c1.
x);
2092 c2m = c2.
y - (k * c2.
x);
2100 k = -deltaY / deltaX;
2101 for (t = 0; t < n1; t++)
2104 thevalue = theP->
x - (k * theP->
y);
2109 for (t = 0; t < n2; t++)
2112 thevalue = theP->
x - (k * theP->
y);
2117 c1m = c1.
x - (k * c1.
y);
2118 c2m = c2.
x - (k * c2.
y);
2161 const POINT2D *p1, *p2, *p3, *p4, *p01, *p02;
2162 int pnr1, pnr2, pnr3, pnr4, n1, n2, i, u,
r, twist;
2167 LWDEBUG(2,
"lw_dist2d_pre_seg_seg is called");
2174 for (i = (n1 - 1); i >= 0; --i)
2178 if (((list2[0].themeasure - list1[i].themeasure)) > maxmeasure)
2182 for (
r = -1;
r <= 1;
r += 2)
2184 pnr1 = list1[i].
pnr;
2189 if ((p1->
x == p01->
x) && (p1->
y == p01->
y))
2196 else if (pnr1 +
r > (n1 - 1))
2199 if ((p1->
x == p01->
x) && (p1->
y == p01->
y))
2209 for (u = 0; u < n2; ++u)
2211 if (((list2[u].themeasure - list1[i].themeasure)) >= maxmeasure)
2213 pnr3 = list2[u].
pnr;
2218 if ((p3->
x == p02->
x) && (p3->
y == p02->
y))
2232 if (pnr3 >= (n2 - 1))
2235 if ((p3->
x == p02->
x) && (p3->
y == p02->
y))
2267 if ((A->
x == B->
x) && (A->
y == B->
y))
2273 if ((C->
x == D->
x) && (C->
y == D->
y))
2310 if ((A->
x == B->
x) && (A->
y == B->
y))
2328 r = ((p->
x - A->
x) * (B->
x - A->
x) + (p->
y - A->
y) * (B->
y - A->
y)) /
2329 ((B->
x - A->
x) * (B->
x - A->
x) + (B->
y - A->
y) * (B->
y - A->
y));
2347 if ((((A->
y - p->
y) * (B->
x - A->
x) == (A->
x - p->
x) * (B->
y - A->
y))) && (dl->
mode ==
DIST_MIN))
2356 c.
x = A->
x +
r * (B->
x - A->
x);
2357 c.
y = A->
y +
r * (B->
y - A->
y);
2367 double hside = thep2->
x - thep1->
x;
2368 double vside = thep2->
y - thep1->
y;
2369 double dist = sqrt(hside * hside + vside * vside);
2399 double hside = p2->
x - p1->
x;
2400 double vside = p2->
y - p1->
y;
2402 return hypot(hside, vside);
2410 if ((A->
x == B->
x) && (A->
y == B->
y))
2428 double ba_x = (B->
x - A->
x);
2429 double ba_y = (B->
y - A->
y);
2430 double ab_length_sqr = (ba_x * ba_x + ba_y * ba_y);
2431 double ca_x = (C->
x - A->
x);
2432 double ca_y = (C->
y - A->
y);
2433 double dot_ac_ab = (ca_x * ba_x + ca_y * ba_y);
2437 if (dot_ac_ab >= ab_length_sqr)
2450 double s_numerator = ca_x * ba_y - ca_y * ba_x;
2453 return s_numerator * s_numerator / ab_length_sqr;
2463 if (A->
x == B->
x && A->
y == B->
y)
2465 *d = fmod(2 * M_PI + M_PI / 2 - atan2(B->
y - A->
y, B->
x - A->
x), 2 * M_PI);
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)
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)
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.