@ Pure public static double getPointProjectionFactorOnSegmentLine ( double px , double py , double pz , double s1x , double s1y , double s1z , double s2x , double s2y , double s2z ) { double dx = s2x - s1x ; double dy = s2y - s1y ; double dz = s2z - s1z ; if ( dx == 0. && dy == 0. && dz == 0. ) return 0. ; return ( ( px - s1x ) * dx + ( py - s1y ) * dy + ( pz - s1z ) * dz ) / ( dx * dx + dy * dy + dz * dz ) ; }
Replies the projection a point on a segment .