00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // ---------------------------------------------------------------------- 00030 // Class G4ToroidalSurface 00031 // 00032 // Class Description: 00033 // 00034 // Definition of a toroidal surface. 00035 00036 // Authors: J.Sulkimo, P.Urban. 00037 // Revisions by: L.Broglia, G.Cosmo. 00038 // ---------------------------------------------------------------------- 00039 00040 #ifndef __G4TOROIDALSURAFCE 00041 #define __G4TOROIDALSURAFCE 00042 00043 #include "G4FPlane.hh" 00044 #include "G4OsloMatrix.hh" 00045 00046 class G4ToroidalSurface : public G4Surface 00047 { 00048 00049 public: // with description 00050 00051 G4ToroidalSurface(); 00052 G4ToroidalSurface(const G4Vector3D&, 00053 const G4Vector3D&, 00054 const G4Vector3D&, 00055 G4double, 00056 G4double); 00057 virtual ~G4ToroidalSurface(); 00058 // Constructors & destructor. 00059 00060 inline G4String GetEntityType() const; 00061 // Returns type identifier of the shape. 00062 00063 G4int Intersect(const G4Ray&); 00064 // Determines the intersection of a ray with a torus. 00065 // Returns 1 if the ray intersects the torus. 00066 00067 void CalcBBox(); 00068 // Computes the bounding-box. 00069 00070 inline G4Vector3D GetDirection() const; 00071 inline G4Vector3D GetAxis() const; 00072 inline G4Point3D GetLocation() const; 00073 inline G4double GetMinRadius() const; 00074 inline G4double GetMaxRadius() const; 00075 // Accessors to geometrical data. 00076 00077 G4double ClosestDistanceToPoint(const G4Point3D& x); 00078 // Returns the closest distance to the torus surface from a point x. 00079 00080 virtual G4Vector3D SurfaceNormal(const G4Point3D& Pt) const; 00081 // Returns the Normal unit vector to the G4ToroidalSurface at a point Pt 00082 // on (or nearly on) the G4ToroidalSurface. 00083 00084 inline void MultiplyPointByMatrix(G4Point3D& Base); 00085 inline void MultiplyVectorByMatrix(G4Vector3D& DCos); 00086 // Utility methods. 00087 00088 private: 00089 00090 G4ToroidalSurface(const G4ToroidalSurface&); 00091 G4ToroidalSurface& operator=(const G4ToroidalSurface&); 00092 // Private copy constructor and assignment operator. 00093 00094 inline G4int IsZero(G4double x) const; 00095 G4int SolveQuartic(G4double c[], G4double s[]); 00096 G4int SolveCubic (G4double c[], G4double s[]); 00097 G4int SolveQuadric(G4double c[], G4double s[]); 00098 // Algorithms for solving quadratic, cubic and quartic equations. 00099 00100 private: 00101 00102 G4Axis2Placement3D Placement; 00103 G4double MinRadius; 00104 G4double MaxRadius; 00105 G4PointMatrix* TransMatrix; // transformation matrix 00106 G4Point3D hitpoint; 00107 const G4double EQN_EPS; 00108 00109 }; 00110 00111 #include "G4ToroidalSurface.icc" 00112 00113 #endif