Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ConicalSurface.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 G4ConicalSurface
31 //
32 // Class Description:
33 //
34 // A G4ConicalSurface is a semi-infinite conical surface defined by
35 // an axis and an opening angle, defined as the angle between the axis
36 // and the conical surface, with the origin being the apex of the cone.
37 
38 // The code for G4ConicalSurface has been derived from the original
39 // implementation in the "Gismo" package.
40 //
41 // Author: A.Breakstone
42 // Adaptation: J.Sulkimo, P.Urban.
43 // Revisions by: L.Broglia, G.Cosmo.
44 // ----------------------------------------------------------------------
45 #ifndef __G4CONICALSURFACE_H
46 #define __G4CONICALSURFACE_H
47 
48 #include "G4Surface.hh"
49 
50 
52 {
53 
54 public: // with description
55 
57  // Default constructor:
58  // default axis is ( 1.0, 0.0, 0.0 ),
59  // default angle is 1.0 radians.
60 
61  G4ConicalSurface( const G4Point3D& o, const G4Vector3D& a, G4double e );
62  // Normal constructor:
63  // first argument is the origin of the G4ConicalSurface
64  // second argument is the axis of the G4ConicalSurface
65  // third argument is the angle of the G4ConicalSurface.
66 
67  virtual ~G4ConicalSurface();
68  // Virtual destructor.
69 
70  inline G4int operator==( const G4ConicalSurface& c );
71  // Equality operator.
72 
73  inline G4String GetEntityType() const;
74  // Returns type identifier of the shape.
75 
76  virtual const char* NameOf() const;
77  // Returns the class name.
78 
79  virtual void PrintOn( std::ostream& os = G4cout ) const;
80  // Printing function, streaming surface's attributes.
81 
82  virtual G4double HowNear( const G4Vector3D& x ) const;
83  // Returns the distance from a point to a semi-infinite G4ConicalSurface.
84  // The point x is the (input) argument.
85  // The distance is positive if the point is Inside, negative if it
86  // is outside
87 
88  void CalcBBox();
89  // Computes the bounding-box.
90 
91  G4int Intersect( const G4Ray& ry );
92  // Returns the distance along a Ray (straight line with G4Vector3D) to
93  // leave or enter a G4ConicalSurface.
94  // If the G4Vector3D of the Ray is opposite to that of the Normal to
95  // the G4ConicalSurface at the intersection point, it will not leave the
96  // G4ConicalSurface.
97  // Similarly, if the G4Vector3D of the Ray is along that of the Normal
98  // to the G4ConicalSurface at the intersection point, it will not enter the
99  // G4ConicalSurface.
100  // This method is called by all finite shapes sub-classed to
101  // G4ConicalSurface.
102  // A negative result means no intersection.
103  // If no valid intersection point is found, set the distance
104  // and intersection point to large numbers.
105 
106  virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const;
107  // Returns the Normal unit vector to the G4ConicalSurface at a point p
108  // on (or nearly on) the G4ConicalSurface.
109 
110  virtual G4int Inside( const G4Vector3D& x ) const;
111  // Returns 1 if the point x is Inside the G4ConicalSurface, 0 otherwise.
112  // Outside means that the distance to the G4ConicalSurface would be
113  // negative. Uses the HowNear() function to calculate this distance.
114 
115  virtual G4int WithinBoundary( const G4Vector3D& x ) const;
116  // Returns 1 if point x is on the G4ConicalSurface, otherwise return zero
117  // Since a G4ConicalSurface is infinite in extent, the function
118  // will just check if the point is on the G4ConicalSurface (to the surface
119  // precision).
120 
121  virtual G4double Scale() const;
122  // Function overwritten by finite-sized derived classes which returns
123  // a radius, unless it is zero, in which case it returns the smallest
124  // non-zero dimension.
125  // Since a semi-infinite cone has no Scale associated with it, it returns
126  // the arbitrary number 1.0.
127  // Used for Scale-invariant tests of surface thickness.
128 
129  inline G4Vector3D GetAxis() const;
130  inline G4double GetAngle() const;
131  // Return the axis and angle of the G4ConicalSurface.
132 
133  void SetAngle( G4double e );
134  // Changes the angle of the G4ConicalSurface.
135  // Requires angle to range from 0 to PI/2.
136 
137 public: // without description
138 
139 /*
140  virtual G4double distanceAlongRay( G4int which_way, const G4Ray* ry,
141  G4Vector3D& p ) const;
142  // Returns the distance along a Ray to enter or leave a G4ConicalSurface.
143  // The first (input) argument is +1 to leave or -1 to enter
144  // The second (input) argument is a pointer to the Ray
145  // The third (output) argument returns the intersection point.
146 
147  virtual G4double distanceAlongHelix( G4int which_way, const Helix* hx,
148  G4Vector3D& p ) const;
149  // Returns the distance along a Helix to enter or leave a G4ConicalSurface.
150  // The first (input) argument is +1 to leave or -1 to enter
151  // The second (input) argument is a pointer to the Helix
152  // The third (output) argument returns the intersection point.
153 
154  G4Vector3D Normal( const G4Vector3D& p ) const;
155  // Returns the Normal unit vector to a G4ConicalSurface
156  // at a point p on (or nearly on) the G4ConicalSurface.
157 
158  virtual void rotate( G4double alpha, G4double beta,
159  G4double gamma, G4ThreeMat& m, G4int inverse );
160  // Rotates the G4ConicalSurface (angles are assumed to be given in
161  // radians), arguments:
162  // - first about global x-axis by angle alpha,
163  // - second about global y-axis by angle beta,
164  // - third about global z-axis by angle gamma,
165  // - fourth (output) argument gives the calculated rotation matrix,
166  // - fifth (input) argument is an integer flag which if
167  // non-zero reverses the order of the rotations.
168 
169  virtual void rotate( G4double alpha, G4double beta,
170  G4double gamma, G4int inverse );
171  // Rotates the G4ConicalSurface (angles are assumed to be given in
172  // radians), arguments:
173  // - first about global x-axis by angle alpha,
174  // - second about global y-axis by angle beta,
175  // - third about global z-axis by angle gamma,
176  // - fourth (input) argument is an integer flag which if
177  // non-zero reverses the order of the rotations.
178 
179 private:
180 
181  virtual G4double gropeAlongHelix( const Helix* hx ) const;
182  // Private function to use a crude technique to find the intersection
183  // of a Helix with a G4ConicalSurface. It returns the turning angle
184  // along the Helix at which the intersection occurs or -1.0 if no
185  // intersection point is found.
186  // The argument to the call is the pointer to the Helix.
187 */
188 
189 private:
190 
192  G4ConicalSurface& operator=(const G4ConicalSurface&);
193  // Private copy constructor and assignment operator.
194 
195 private:
196 
197  G4Vector3D axis;
198  // Direction of axis of G4ConicalSurface (unit vector).
199 
200  G4double angle;
201  // Half opening angle of G4ConicalSurface, in radians
202  // range is 0 < angle < PI/2.
203 
204 };
205 
206 #include "G4ConicalSurface.icc"
207 
208 #endif