35 : EndpointA(PntA), VecAtoB(PntB-PntA)
37 fABdistanceSq = VecAtoB.
mag2();
44 G4double sq_VecAZ, inner_prod, unit_projection ;
46 VecAZ= OtherPnt - EndpointA;
47 sq_VecAZ = VecAZ.
mag2();
49 inner_prod= VecAtoB.
dot( VecAZ );
53 if( fABdistanceSq != 0.0 )
56 unit_projection = inner_prod/fABdistanceSq;
58 if( (0. <= unit_projection ) && (unit_projection <= 1.0 ) )
60 dist_sq= sq_VecAZ - unit_projection * inner_prod ;
67 if( unit_projection < 0. )
75 dist_sq = VecBZ.
mag2();
81 dist_sq = (OtherPnt - EndpointA).mag2() ;
83 if( dist_sq < 0.0 ) dist_sq = 0.0 ;
85 return std::sqrt(dist_sq) ;
double dot(const Hep3Vector &) const
G4LineSection(const G4ThreeVector &PntA, const G4ThreeVector &PntB)
G4double Dist(G4ThreeVector OtherPnt) const