1307 double mindist=DBL_MAX;
1310 POINT4D start4d, end4d, projtmp;
1312 const POINT2D *start = NULL, *end = NULL;
1318 if ( ! proj4d ) proj4d = &projtmp;
1340 if ( dist < mindist )
1346 LWDEBUG(3,
"Breaking on mindist=0");
1354 if ( mindistout ) *mindistout = mindist;
1356 LWDEBUGF(3,
"Closest segment: %d", seg);
1357 LWDEBUGF(3,
"mindist: %g", mindist);
1379 LWDEBUGF(3,
"Closest point on segment: %g,%g", proj.
x, proj.
y);
1387 if ( tlen == 0 )
return 0;
1391 for (t=0; t<seg; t++, start=end)
1396 LWDEBUGF(4,
"Segment %d made plen %g", t, plen);
1401 LWDEBUGF(3,
"plen %g, tlen %g", plen, tlen);
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
double distance2d_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
int p2d_same(const POINT2D *p1, const POINT2D *p2)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void closest_point_on_segment(const POINT4D *p, const POINT4D *A, const POINT4D *B, POINT4D *ret)
double ptarray_length_2d(const POINTARRAY *pts)
Find the 2d length of the given POINTARRAY (even if it's 3d)