Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ToroidalSurface.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 G4ToroidalSurface
31 //
32 // Class Description:
33 //
34 // Definition of a toroidal surface.
35 
36 // Authors: J.Sulkimo, P.Urban.
37 // Revisions by: L.Broglia, G.Cosmo.
38 // ----------------------------------------------------------------------
39 
40 #ifndef __G4TOROIDALSURAFCE
41 #define __G4TOROIDALSURAFCE
42 
43 #include "G4FPlane.hh"
44 #include "G4OsloMatrix.hh"
45 
47 {
48 
49  public: // with description
50 
53  const G4Vector3D&,
54  const G4Vector3D&,
55  G4double,
56  G4double);
57  virtual ~G4ToroidalSurface();
58  // Constructors & destructor.
59 
60  inline G4String GetEntityType() const;
61  // Returns type identifier of the shape.
62 
63  G4int Intersect(const G4Ray&);
64  // Determines the intersection of a ray with a torus.
65  // Returns 1 if the ray intersects the torus.
66 
67  void CalcBBox();
68  // Computes the bounding-box.
69 
70  inline G4Vector3D GetDirection() const;
71  inline G4Vector3D GetAxis() const;
72  inline G4Point3D GetLocation() const;
73  inline G4double GetMinRadius() const;
74  inline G4double GetMaxRadius() const;
75  // Accessors to geometrical data.
76 
78  // Returns the closest distance to the torus surface from a point x.
79 
80  virtual G4Vector3D SurfaceNormal(const G4Point3D& Pt) const;
81  // Returns the Normal unit vector to the G4ToroidalSurface at a point Pt
82  // on (or nearly on) the G4ToroidalSurface.
83 
84  inline void MultiplyPointByMatrix(G4Point3D& Base);
85  inline void MultiplyVectorByMatrix(G4Vector3D& DCos);
86  // Utility methods.
87 
88 private:
89 
91  G4ToroidalSurface& operator=(const G4ToroidalSurface&);
92  // Private copy constructor and assignment operator.
93 
94  inline G4int IsZero(G4double x) const;
95  G4int SolveQuartic(G4double c[], G4double s[]);
96  G4int SolveCubic (G4double c[], G4double s[]);
97  G4int SolveQuadric(G4double c[], G4double s[]);
98  // Algorithms for solving quadratic, cubic and quartic equations.
99 
100 private:
101 
102  G4Axis2Placement3D Placement;
103  G4double MinRadius;
104  G4double MaxRadius;
105  G4PointMatrix* TransMatrix; // transformation matrix
106  G4Point3D hitpoint;
107  const G4double EQN_EPS;
108 
109 };
110 
111 #include "G4ToroidalSurface.icc"
112 
113 #endif