Finds the two closest points on two linesegments.
Definition at line 918 of file measures3d.c.
923 double a, b, c, d, e, D;
926 if ( ( s1p1->
x == s1p2->
x) && (s1p1->
y == s1p2->
y) && (s1p1->
z == s1p2->
z) )
931 if ( ( s2p1->
x == s2p2->
x) && (s2p1->
y == s2p2->
y) && (s2p1->
z == s2p2->
z) )
974 s1k = (b*e - c*d) / D;
975 s2k = (a*e - b*d) / D;
979 if(s1k<0.0||s1k>1.0||s2k<0.0||s2k>1.0)
1016 p1.
x=s1p1->
x+s1k*(s1p2->
x-s1p1->
x);
1017 p1.
y=s1p1->
y+s1k*(s1p2->
y-s1p1->
y);
1018 p1.
z=s1p1->
z+s1k*(s1p2->
z-s1p1->
z);
1020 p2.
x=s2p1->
x+s2k*(s2p2->
x-s2p1->
x);
1021 p2.
y=s2p1->
y+s2k*(s2p2->
y-s2p1->
y);
1022 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.
References DOT, get_3dvector_from_points(), lw_dist3d_pt_pt(), lw_dist3d_pt_seg(), LW_FALSE, LW_TRUE, DISTPTS3D::twisted, POINT3DZ::x, POINT3DZ::y, and POINT3DZ::z.
Referenced by lw_dist3d_ptarray_ptarray().