Finds the two closest points on two linesegments.
Definition at line 921 of file measures3d.c.
References DOT, get_3dvector_from_points(), lw_dist3d_pt_pt(), lw_dist3d_pt_seg(), LW_FALSE, LW_TRUE, rect_node::p1, rect_node::p2, DISTPTS3D::twisted, POINT3DZ::x, POINT3DZ::y, and POINT3DZ::z.
Referenced by lw_dist3d_ptarray_ptarray().
926 double a, b, c, d, e, D;
929 if ( ( s1p1->
x == s1p2->
x) && (s1p1->
y == s1p2->
y) && (s1p1->
z == s1p2->
z) )
934 if ( ( s2p1->
x == s2p2->
x) && (s2p1->
y == s2p2->
y) && (s2p1->
z == s2p2->
z) )
977 s1k = (b*e - c*d) / D;
978 s2k = (a*e - b*d) / D;
982 if(s1k<0.0||s1k>1.0||s2k<0.0||s2k>1.0)
1019 p1.
x=s1p1->
x+s1k*(s1p2->
x-s1p1->
x);
1020 p1.
y=s1p1->
y+s1k*(s1p2->
y-s1p1->
y);
1021 p1.
z=s1p1->
z+s1k*(s1p2->
z-s1p1->
z);
1023 p2.
x=s2p1->
x+s2k*(s2p2->
x-s2p1->
x);
1024 p2.
y=s2p1->
y+s2k*(s2p2->
y-s2p1->
y);
1025 p2.
z=s2p1->
z+s2k*(s2p2->
z-s2p1->
z);
#define LW_TRUE
Return types for functions with status returns.
int lw_dist3d_pt_pt(POINT3DZ *thep1, POINT3DZ *thep2, DISTPTS3D *dl)
Compares incomming points and stores the points closest to each other or most far away from each othe...
static int get_3dvector_from_points(POINT3DZ *p1, POINT3DZ *p2, VECTOR3D *v)
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...