00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4PolyPhiFace.icc 67011 2013-01-29 16:17:41Z gcosmo $ 00028 // 00029 // 00030 // -------------------------------------------------------------------- 00031 // GEANT 4 inline definitions file 00032 // 00033 // G4PolyPhiFace.icc 00034 // 00035 // Implementation of inline methods of G4PolyPhiFace 00036 // -------------------------------------------------------------------- 00037 00038 inline 00039 G4VCSGface* G4PolyPhiFace::Clone() 00040 { 00041 return new G4PolyPhiFace(*this); 00042 } 00043 00044 // ExactZOrder 00045 // 00046 // Decide precisely whether a trajectory passes to the left, right, or exactly 00047 // passes through the z position of a vertex point in our face. 00048 // 00049 // Result is only determined within an arbitrary (positive) factor. 00050 // > 0 to the right 00051 // < 0 to the left 00052 // = 0 exactly on top of 00053 // In 99.9999% of the cases, a trivial calculation is used. In difficult 00054 // cases, a precise, compliant calculation is relied on. 00055 // 00056 inline 00057 G4double G4PolyPhiFace::ExactZOrder( G4double z, 00058 G4double qx, G4double qy, G4double qz, 00059 const G4ThreeVector &v, 00060 G4double normSign, 00061 const G4PolyPhiFaceVertex *vert ) const 00062 { 00063 G4double answer = vert->z - z; 00064 if (std::fabs(answer) < kCarTolerance) 00065 { 00066 G4ThreeVector qa( qx - vert->x + radial.x(), 00067 qy - vert->y + radial.y(), qz - vert->z ), 00068 qb( qx - vert->x, qy - vert->y, qz - vert->z ); 00069 G4ThreeVector qacb = qa.cross(qb); 00070 00071 answer = normSign*qacb.dot(v)*(normal.y()*radial.x()-normal.x()*radial.y()); 00072 } 00073 00074 return answer; 00075 }