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