Finds the two closest points on two linesegments.
1145 double a, b, c, d, e, D;
1148 if ((s1p1->x == s1p2->x) && (s1p1->y == s1p2->y) && (s1p1->z == s1p2->z))
1153 if ((s2p1->x == s2p2->x) && (s2p1->y == s2p2->y) && (s2p1->z == s2p2->z))
1181 if (D < 0.000000001)
1193 s1k = (b * e - c * d) / D;
1194 s2k = (a * e - b * d) / D;
1200 if (s1k <= 0.0 || s1k >= 1.0 || s2k <= 0.0 || s2k >= 1.0)
1227 p1.
x = s1p1->x + s1k * (s1p2->x - s1p1->x);
1228 p1.
y = s1p1->y + s1k * (s1p2->y - s1p1->y);
1229 p1.
z = s1p1->z + s1k * (s1p2->z - s1p1->z);
1231 p2.
x = s2p1->x + s2k * (s2p2->x - s2p1->x);
1232 p2.
y = s2p1->y + s2k * (s2p2->y - s2p1->y);
1233 p2.
z = s2p1->z + s2k * (s2p2->z - s2p1->z);
#define LW_TRUE
Return types for functions with status returns.
static int get_3dvector_from_points(POINT3DZ *p1, POINT3DZ *p2, VECTOR3D *v)
int lw_dist3d_pt_pt(POINT3DZ *thep1, POINT3DZ *thep2, DISTPTS3D *dl)
Compares incoming points and stores the points closest to each other or most far away from each other...
int lw_dist3d_pt_seg(POINT3DZ *p, POINT3DZ *A, POINT3DZ *B, DISTPTS3D *dl)
If searching for min distance, this one finds the closest point on segment A-B from p.