57 lines
1.8 KiB
Plaintext
57 lines
1.8 KiB
Plaintext
// This code implementation is the intellectual property of
|
|
// the GEANT4 collaboration.
|
|
//
|
|
// By copying, distributing or modifying the Program (or any work
|
|
// based on the Program) you indicate your acceptance of this statement,
|
|
// and all its terms.
|
|
//
|
|
// $Id: G4PolyPhiFace.icc,v 1.2 2000/11/02 16:54:48 gcosmo Exp $
|
|
// GEANT4 tag $Name: geant4-03-00 $
|
|
//
|
|
//
|
|
// --------------------------------------------------------------------
|
|
// GEANT 4 inline definitions file
|
|
//
|
|
// G4PolyPhiFace.icc
|
|
//
|
|
// Implementation of inline methods of G4PolyPhiFace
|
|
// --------------------------------------------------------------------
|
|
|
|
inline
|
|
G4VCSGface* G4PolyPhiFace::Clone()
|
|
{
|
|
return new G4PolyPhiFace(*this);
|
|
}
|
|
|
|
// ExactZOrder
|
|
//
|
|
// Decide precisely whether a trajectory passes to the left, right, or exactly
|
|
// passes through the z position of a vertex point in our face.
|
|
//
|
|
// Result is only determined within an arbitrary (positive) factor.
|
|
// > 0 to the right
|
|
// < 0 to the left
|
|
// = 0 exactly on top of
|
|
// In 99.9999% of the cases, a trivial calculation is used. In difficult
|
|
// cases, a precise, compliant calculation is relied on.
|
|
//
|
|
inline
|
|
G4double G4PolyPhiFace::ExactZOrder( G4double z,
|
|
G4double qx, G4double qy, G4double qz,
|
|
const G4ThreeVector &v,
|
|
G4double normSign,
|
|
const G4PolyPhiFaceVertex *vert ) const
|
|
{
|
|
G4double answer = vert->z - z;
|
|
if (fabs(answer) < kCarTolerance) {
|
|
G4ThreeVector qa( qx - vert->x + radial.x(),
|
|
qy - vert->y + radial.y(), qz - vert->z ),
|
|
qb( qx - vert->x, qy - vert->y, qz - vert->z );
|
|
G4ThreeVector qacb = qa.cross(qb);
|
|
|
|
answer = normSign*qacb.dot(v)*(normal.y()*radial.x()-normal.x()*radial.y());
|
|
}
|
|
|
|
return answer;
|
|
}
|