1388         double mindist=DBL_MAX;
 
 1391         POINT4D start4d, end4d, projtmp;
 
 1393         const POINT2D *start = NULL, *end = NULL;
 
 1399         if ( ! proj4d ) proj4d = &projtmp;
 
 1421                 if (dist_sqr < mindist)
 
 1427                                 LWDEBUG(3, 
"Breaking on mindist=0");
 
 1434         mindist = sqrt(mindist);
 
 1436         if ( mindistout ) *mindistout = mindist;
 
 1438         LWDEBUGF(3, 
"Closest segment: %d", seg);
 
 1439         LWDEBUGF(3, 
"mindist: %g", mindist);
 
 1461         LWDEBUGF(3, 
"Closest point on segment: %g,%g", proj.
x, proj.
y);
 
 1469         if ( tlen == 0 ) 
return 0;
 
 1473         for (t=0; t<seg; t++, start=end)
 
 1478                 LWDEBUGF(4, 
"Segment %d made plen %g", t, plen);
 
 1483         LWDEBUGF(3, 
"plen %g, tlen %g", plen, tlen);
 
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
double distance2d_sqr_pt_seg(const POINT2D *p, const POINT2D *A, const POINT2D *B)
int p2d_same(const POINT2D *p1, const POINT2D *p2)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
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)