77 lines
3.2 KiB
Plaintext
77 lines
3.2 KiB
Plaintext
//
|
|
// ********************************************************************
|
|
// * License and Disclaimer *
|
|
// * *
|
|
// * The Geant4 software is copyright of the Copyright Holders of *
|
|
// * the Geant4 Collaboration. It is provided under the terms and *
|
|
// * conditions of the Geant4 Software License, included in the file *
|
|
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
|
// * include a list of copyright holders. *
|
|
// * *
|
|
// * Neither the authors of this software system, nor their employing *
|
|
// * institutes,nor the agencies providing financial support for this *
|
|
// * work make any representation or warranty, express or implied, *
|
|
// * regarding this software system or assume any liability for its *
|
|
// * use. Please see the license in the file LICENSE and URL above *
|
|
// * for the full disclaimer and the limitation of liability. *
|
|
// * *
|
|
// * This code implementation is the result of the scientific and *
|
|
// * technical work of the GEANT4 collaboration. *
|
|
// * By using, copying, modifying or distributing the software (or *
|
|
// * any work based on the software) you agree to acknowledge its *
|
|
// * use in resulting scientific publications, and indicate your *
|
|
// * acceptance of all terms of the Geant4 Software license. *
|
|
// ********************************************************************
|
|
//
|
|
//
|
|
// $Id: G4PolyPhiFace.icc,v 1.6 2006/06/29 18:47:10 gunter Exp $
|
|
// GEANT4 tag $Name: geant4-09-01 $
|
|
//
|
|
//
|
|
// --------------------------------------------------------------------
|
|
// 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 (std::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;
|
|
}
|