Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
@@ -5,10 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LineSection.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LineSection.cc,v 1.3 2000/02/25 16:57:15 grichine Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// typedef double G4double;
#include "G4LineSection.hh"
G4LineSection::G4LineSection( const G4ThreeVector& PntA,
@@ -16,8 +17,15 @@ G4LineSection::G4LineSection( const G4ThreeVector& PntA,
{
EndpointA= PntA;
VecAtoB=PntB-PntA;
inverse_square_distAB=1.0 / VecAtoB.mag2();
G4double distABsquared = VecAtoB.mag2() ;
if ( distABsquared == 0.0)
{
G4Exception("Equal points in G4LineSection::G4LineSection: line->point ?") ;
}
else
{
inverse_square_distAB=1.0 / distABsquared ;
}
}
G4double G4LineSection::Dist( G4ThreeVector OtherPnt ) const
@@ -36,23 +44,31 @@ G4double G4LineSection::Dist( G4ThreeVector OtherPnt ) const
unit_projection= inner_prod * InvsqDistAB();
if( (0. <= unit_projection ) && (unit_projection <= 1.0 ) )
dist_sq= sq_VecAZ - unit_projection * inner_prod;
else{
{
dist_sq= sq_VecAZ - unit_projection * inner_prod ;
}
else
{
// The perpendicular from the point to the line AB meets the line
// in a point outside the line segment!
//
if( unit_projection < 0. ) {
if( unit_projection < 0. )
{
// A is the closest point
dist_sq= sq_VecAZ;
}else{
}
else
{
// B is the closest point
G4ThreeVector EndpointB = EndpointA + VecAtoB;
G4ThreeVector VecBZ = OtherPnt - EndpointB;
dist_sq = VecBZ.mag2();
}
}
if( dist_sq < 0.0 ) dist_sq = 0.0 ;
return sqrt(dist_sq);
return sqrt(dist_sq) ;
}
G4double G4LineSection::Distline( const G4ThreeVector& OtherPnt,