[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. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4FPlane.hh,v 1.13 2006/06/29 18:39:30 gunter Exp $ |
---|
[1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[831] | 29 | // |
---|
| 30 | // ---------------------------------------------------------------------- |
---|
| 31 | // Class G4FPlane |
---|
| 32 | // |
---|
| 33 | // Class Description: |
---|
| 34 | // |
---|
| 35 | // A G4FPlane is a plane created by 3 points or by an origin, an axis and |
---|
| 36 | // a direction. The plane created is a G4Plane, where his coefficient a, b, |
---|
| 37 | // c and d are stored. The equation of the plane is: |
---|
| 38 | // ax + by + cz = d |
---|
| 39 | // |
---|
| 40 | // This class contain 2 intersection functions : |
---|
| 41 | // - closest intersection |
---|
| 42 | // - intersection by a ray |
---|
| 43 | |
---|
| 44 | // Authors: J.Sulkimo, P.Urban. |
---|
| 45 | // Revisions by: L.Broglia, S.Giani, G.Cosmo. |
---|
| 46 | // ---------------------------------------------------------------------- |
---|
| 47 | // |
---|
| 48 | // History |
---|
| 49 | // ------- |
---|
| 50 | // - SurfaceNormal always returns the direction of NormalX, always containing |
---|
| 51 | // the correct orientation for all faces (S.Giani). |
---|
| 52 | // - Addition of default argument sense = 1 in the second constructor (S.Giani). |
---|
| 53 | // - The constructor using iVec now properly stores both the internal and |
---|
| 54 | // external boundaries in the bounds vector (S.Giani). |
---|
| 55 | // - Proper initialization of sameSense in both the constructors (S.Giani). |
---|
| 56 | // - Addition of third argument (sense) in the second constructor to ensure |
---|
| 57 | // consistent setting of the normal in all the client code (S.Giani). |
---|
| 58 | // - Proper use of the tolerance in the Intersect function (S.Giani). |
---|
| 59 | // ---------------------------------------------------------------------- |
---|
| 60 | #ifndef __PLANESURFACE_H |
---|
| 61 | #define __PLANESURFACE_H |
---|
| 62 | |
---|
| 63 | #include "G4Axis2Placement3D.hh" |
---|
| 64 | #include "G4Plane.hh" |
---|
| 65 | #include "G4Surface.hh" |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | class G4FPlane : public G4Surface |
---|
| 69 | { |
---|
| 70 | |
---|
| 71 | public: // with description |
---|
| 72 | |
---|
| 73 | G4FPlane(); |
---|
| 74 | virtual ~G4FPlane(); |
---|
| 75 | // Default constructor & destructor. |
---|
| 76 | |
---|
| 77 | G4FPlane( const G4Vector3D& direction, |
---|
| 78 | const G4Vector3D& axis , |
---|
| 79 | const G4Point3D& Pt0, |
---|
| 80 | G4int sense = 1 ); |
---|
| 81 | // Normal constructor. |
---|
| 82 | |
---|
| 83 | G4FPlane(const G4Point3DVector* pVec, |
---|
| 84 | const G4Point3DVector* iVec= 0, |
---|
| 85 | G4int sense = 1); |
---|
| 86 | // Constructor used by G4BREPSolidBox and G4BREPSolidPolyhedra. |
---|
| 87 | |
---|
| 88 | G4int Intersect(const G4Ray& G4Rayref); |
---|
| 89 | // Calculates the intersection of the plane and a ray. |
---|
| 90 | |
---|
| 91 | void CalcBBox(); |
---|
| 92 | // Calculates bounding box. |
---|
| 93 | |
---|
| 94 | void Project(); |
---|
| 95 | // Computes the projection of the plane. |
---|
| 96 | |
---|
| 97 | inline G4int GetConvex() const; |
---|
| 98 | // Return plane's convexity, if so. |
---|
| 99 | |
---|
| 100 | inline G4int GetNumberOfPoints() const; |
---|
| 101 | // Gets the number of the points on the surface boundary. |
---|
| 102 | |
---|
| 103 | inline G4Point3D GetSrfPoint() const; |
---|
| 104 | // Gets the location point on the surface. |
---|
| 105 | |
---|
| 106 | inline const G4Point3D& GetPoint(G4int Count) const; |
---|
| 107 | // Gets a surface boundary point. |
---|
| 108 | |
---|
| 109 | void CalcNormal(); |
---|
| 110 | // Computes normal to surface. |
---|
| 111 | |
---|
| 112 | inline G4Vector3D SurfaceNormal(const G4Point3D& Pt) const; |
---|
| 113 | // Returns normal to surface. |
---|
| 114 | |
---|
| 115 | inline const char* Name() const; |
---|
| 116 | // Returns the type identifier. |
---|
| 117 | |
---|
| 118 | G4double ClosestDistanceToPoint(const G4Point3D& Pt); |
---|
| 119 | // Returns the closest distance from point Pt. |
---|
| 120 | |
---|
| 121 | G4double HowNear( const G4Vector3D& x ) const ; |
---|
| 122 | // Computes the shortest distance from the point x to the G4FPlane. |
---|
| 123 | // The distance will always be positive. |
---|
| 124 | |
---|
| 125 | inline G4Axis2Placement3D GetPplace() const; |
---|
| 126 | inline G4Plane GetPplane() const; |
---|
| 127 | // Accessors to geometrical data. |
---|
| 128 | |
---|
| 129 | public: // without description |
---|
| 130 | |
---|
| 131 | inline G4int MyType() const; |
---|
| 132 | // Returns the shape type (used in G4BREPSolid). |
---|
| 133 | |
---|
| 134 | G4int IsConvex() const; |
---|
| 135 | // Returns -1. (?) |
---|
| 136 | |
---|
| 137 | inline void Deactivate(); |
---|
| 138 | // Deactive, used in G4Surface. |
---|
| 139 | |
---|
| 140 | inline G4Ray* Norm(); |
---|
| 141 | // Returns the normal (used in BREPSolid). |
---|
| 142 | |
---|
| 143 | inline const G4Point3D& GetHitPoint() const; |
---|
| 144 | // Returns the hit point of the ray on the surface. |
---|
| 145 | |
---|
| 146 | protected: |
---|
| 147 | |
---|
| 148 | void InitBounded(); |
---|
| 149 | |
---|
| 150 | protected: |
---|
| 151 | |
---|
| 152 | G4Point3D hitpoint; |
---|
| 153 | // Hit point of the ray on the surface. |
---|
| 154 | |
---|
| 155 | private: |
---|
| 156 | |
---|
| 157 | G4FPlane(const G4FPlane&); |
---|
| 158 | G4FPlane& operator=(const G4FPlane&); |
---|
| 159 | // Private copy constructor and assignment operator. |
---|
| 160 | |
---|
| 161 | inline G4int Sign(G4double a) const; |
---|
| 162 | |
---|
| 163 | private: |
---|
| 164 | |
---|
| 165 | G4Axis2Placement3D pplace; |
---|
| 166 | G4Plane Pl; |
---|
| 167 | G4Ray* NormalX; |
---|
| 168 | G4int Convex; |
---|
| 169 | G4SurfaceBoundary* projectedBoundary; |
---|
| 170 | |
---|
| 171 | }; |
---|
| 172 | |
---|
| 173 | #include "G4FPlane.icc" |
---|
| 174 | |
---|
| 175 | #endif |
---|