Finds the two closest points on two linesegments.
1179 double a, b, c, d, e, D;
1196 dl->
p1 = dl->
p2 = *s2p1;
1221 if (D < 0.000000001)
1233 s1k = (b * e - c * d) / D;
1234 s2k = (a * e - b * d) / D;
1240 if (s1k <= 0.0 || s1k >= 1.0 || s2k <= 0.0 || s2k >= 1.0)
1267 p1.
x = s1p1->x + s1k * (s1p2->x - s1p1->x);
1268 p1.
y = s1p1->y + s1k * (s1p2->y - s1p1->y);
1269 p1.
z = s1p1->z + s1k * (s1p2->z - s1p1->z);
1271 p2.
x = s2p1->x + s2k * (s2p2->x - s2p1->x);
1272 p2.
y = s2p1->y + s2k * (s2p2->y - s2p1->y);
1273 p2.
z = s2p1->z + s2k * (s2p2->z - s2p1->z);
#define LW_TRUE
Return types for functions with status returns.
int p3dz_same(const POINT3DZ *p1, const POINT3DZ *p2)
int lw_dist3d_pt_pt(const POINT3DZ *thep1, const POINT3DZ *thep2, DISTPTS3D *dl)
Compares incoming points and stores the points closest to each other or most far away from each other...
static int get_3dvector_from_points(const POINT3DZ *p1, const POINT3DZ *p2, VECTOR3D *v)
int lw_dist3d_pt_seg(const POINT3DZ *p, const POINT3DZ *A, const POINT3DZ *B, DISTPTS3D *dl)
If searching for min distance, this one finds the closest point on segment A-B from p.