37 G4double sq_VecAZ, inner_prod, unit_projection ;
39 VecAZ= OtherPnt - EndpointA;
40 sq_VecAZ = VecAZ.
mag2();
42 inner_prod= VecAtoB.
dot( VecAZ );
46 if( fABdistanceSq != 0.0 )
49 unit_projection = inner_prod/fABdistanceSq;
51 if( (0. <= unit_projection ) && (unit_projection <= 1.0 ) )
53 dist_sq= sq_VecAZ - unit_projection * inner_prod ;
60 if( unit_projection < 0. )
68 dist_sq = VecBZ.
mag2();
74 dist_sq = (OtherPnt - EndpointA).mag2() ;
76 if( dist_sq < 0.0 ) dist_sq = 0.0 ;
78 return std::sqrt(dist_sq) ;
G4double Dist(G4ThreeVector OtherPnt) const
double dot(const Hep3Vector &) const