[831] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration and of QinetiQ Ltd, * |
---|
| 20 | // * subject DEFCON 705 IPR conditions. * |
---|
| 21 | // * By using, copying, modifying or distributing the software (or * |
---|
| 22 | // * any work based on the software) you agree to acknowledge its * |
---|
| 23 | // * use in resulting scientific publications, and indicate your * |
---|
| 24 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 25 | // ******************************************************************** |
---|
| 26 | // |
---|
| 27 | // $Id: G4VFacet.icc,v 1.5 2007/08/23 14:45:03 gcosmo Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[831] | 29 | // |
---|
| 30 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 31 | // |
---|
| 32 | // MODULE: G4VFacet.icc |
---|
| 33 | // |
---|
| 34 | // Version: 0.B |
---|
| 35 | // Date: 15/06/2005 |
---|
| 36 | // Author: P R Truscott |
---|
| 37 | // Organisation: QinetiQ Ltd, UK |
---|
| 38 | // Customer: UK Ministry of Defence : RAO CRP TD Electronic Systems |
---|
| 39 | // Contract: C/MAT/N03517 |
---|
| 40 | // |
---|
| 41 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 42 | // |
---|
| 43 | // CHANGE HISTORY |
---|
| 44 | // -------------- |
---|
| 45 | // |
---|
| 46 | // 31 October 2004, P R Truscott, QinetiQ Ltd, UK - Created. |
---|
| 47 | // |
---|
| 48 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 49 | |
---|
| 50 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 51 | // |
---|
| 52 | inline G4ThreeVector G4VFacet::GetSurfaceNormal () const |
---|
| 53 | {return surfaceNormal;} |
---|
| 54 | |
---|
| 55 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 56 | // |
---|
| 57 | inline G4GeometryType G4VFacet::GetEntityType () const |
---|
| 58 | {return geometryType;} |
---|
| 59 | |
---|
| 60 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 61 | // |
---|
| 62 | inline G4bool G4VFacet::IsInside (const G4ThreeVector &p) const |
---|
| 63 | { |
---|
| 64 | G4ThreeVector D = p - P0; |
---|
| 65 | G4double displacement = D.dot(surfaceNormal); |
---|
| 66 | G4bool inside = (displacement <= 0.0); |
---|
| 67 | |
---|
| 68 | return inside; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 72 | // |
---|
| 73 | inline G4bool G4VFacet::IsDefined () const |
---|
| 74 | {return isDefined;} |
---|
| 75 | |
---|
| 76 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 77 | // |
---|
| 78 | inline size_t G4VFacet::GetVertexIndex (const size_t i) const |
---|
| 79 | { |
---|
| 80 | if (i < I.size()) { return I[i]; } |
---|
| 81 | else { return 999999999; } |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 85 | // |
---|
| 86 | inline size_t G4VFacet::GetNumberOfVertices () const |
---|
| 87 | { |
---|
| 88 | return nVertices; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 92 | // |
---|
| 93 | inline void G4VFacet::SetVertexIndex (const size_t i, const size_t j) |
---|
| 94 | {I[i] = j;} |
---|
| 95 | |
---|
| 96 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 97 | // |
---|
| 98 | inline G4ThreeVector G4VFacet::GetVertex (size_t i) const |
---|
| 99 | { |
---|
| 100 | if (i == 0) { return P0; } |
---|
| 101 | else if (i < nVertices) { return P[i-1]; } |
---|
| 102 | else { return G4ThreeVector(0.0,0.0,0.0); } |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 106 | // |
---|
| 107 | inline G4ThreeVector G4VFacet::GetCircumcentre () const |
---|
| 108 | {return circumcentre;} |
---|
| 109 | |
---|
| 110 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 111 | // |
---|
| 112 | inline G4double G4VFacet::GetRadius () const |
---|
| 113 | {return radius;} |
---|
| 114 | |
---|
| 115 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 116 | // |
---|
| 117 | inline G4double G4VFacet::GetRadiusSquared () const |
---|
| 118 | {return radiusSqr;} |
---|