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