G4Polyhedra.hh

Go to the documentation of this file.
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: G4Polyhedra.hh 67011 2013-01-29 16:17:41Z gcosmo $
00028 //
00029 // 
00030 // --------------------------------------------------------------------
00031 // GEANT 4 class header file
00032 //
00033 //
00034 // G4Polyhedra.hh
00035 //
00036 // Class description:
00037 //
00038 //   Class implementing a CSG-like type "PGON" Geant 3.21 volume,
00039 //   inherited from class G4VCSGfaceted:
00040 //
00041 //   G4Polyhedra( const G4String& name, 
00042 //                G4double phiStart,         - initial phi starting angle
00043 //                G4double phiTotal,         - total phi angle
00044 //                G4int numSide,             - number sides
00045 //                G4int numZPlanes,          - number of z planes
00046 //                const G4double zPlane[],   - position of z planes
00047 //                const G4double rInner[],   - tangent distance to inner surface
00048 //                const G4double rOuter[]  ) - tangent distance to outer surface
00049 //
00050 //   G4Polyhedra( const G4String& name, 
00051 //                G4double phiStart,    - initial phi starting angle
00052 //                G4double phiTotal,    - total phi angle
00053 //                G4int    numSide,     - number sides
00054 //                G4int    numRZ,       - number corners in r,z space
00055 //                const G4double r[],   - r coordinate of these corners
00056 //                const G4double z[] )  - z coordinate of these corners
00057 
00058 // Author: 
00059 //   David C. Williams (davidw@scipp.ucsc.edu)
00060 // --------------------------------------------------------------------
00061 
00062 #ifndef G4Polyhedra_hh
00063 #define G4Polyhedra_hh
00064 
00065 #include "G4VCSGfaceted.hh"
00066 #include "G4PolyhedraSide.hh"
00067 
00068 class G4EnclosingCylinder;
00069 class G4ReduciblePolygon;
00070 class G4PolyhedraHistorical
00071 {
00072   public:
00073 
00074     G4PolyhedraHistorical();
00075     ~G4PolyhedraHistorical();
00076     G4PolyhedraHistorical( const G4PolyhedraHistorical &source );
00077     G4PolyhedraHistorical& operator=( const G4PolyhedraHistorical& right );
00078 
00079     G4double Start_angle;
00080     G4double Opening_angle;
00081     G4int   numSide;
00082     G4int   Num_z_planes;
00083     G4double *Z_values;
00084     G4double *Rmin;
00085     G4double *Rmax;
00086 };
00087 
00088 class G4Polyhedra : public G4VCSGfaceted
00089 {
00090  public:  // with description
00091 
00092   G4Polyhedra( const G4String& name, 
00093                      G4double phiStart,    // initial phi starting angle
00094                      G4double phiTotal,    // total phi angle
00095                      G4int numSide,        // number sides
00096                      G4int numZPlanes,     // number of z planes
00097                const G4double zPlane[],    // position of z planes
00098                const G4double rInner[],    // tangent distance to inner surface
00099                const G4double rOuter[]  ); // tangent distance to outer surface
00100 
00101   G4Polyhedra( const G4String& name, 
00102                      G4double phiStart,    // initial phi starting angle
00103                      G4double phiTotal,    // total phi angle
00104                      G4int    numSide,     // number sides
00105                      G4int    numRZ,       // number corners in r,z space
00106                const G4double r[],         // r coordinate of these corners
00107                const G4double z[]       ); // z coordinate of these corners
00108 
00109   virtual ~G4Polyhedra();
00110 
00111   // Methods for solid
00112 
00113   EInside Inside( const G4ThreeVector &p ) const;
00114   G4double DistanceToIn( const G4ThreeVector &p,
00115                          const G4ThreeVector &v ) const;
00116   G4double DistanceToIn( const G4ThreeVector &p ) const;
00117   
00118   void ComputeDimensions(       G4VPVParameterisation* p,
00119                           const G4int n,
00120                           const G4VPhysicalVolume* pRep);
00121 
00122   G4GeometryType  GetEntityType() const;
00123 
00124   G4VSolid* Clone() const;
00125 
00126   G4ThreeVector GetPointOnSurface() const;
00127 
00128   std::ostream& StreamInfo( std::ostream& os ) const;
00129 
00130   G4Polyhedron* CreatePolyhedron() const;
00131   G4NURBS*      CreateNURBS() const;
00132 
00133   G4bool Reset();
00134 
00135   // Accessors
00136 
00137   inline G4int GetNumSide()     const;
00138   inline G4double GetStartPhi() const;
00139   inline G4double GetEndPhi()   const;
00140   inline G4bool IsOpen()        const;
00141   inline G4bool IsGeneric()     const;
00142   inline G4int GetNumRZCorner() const;
00143   inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
00144 
00145   inline G4PolyhedraHistorical* GetOriginalParameters() const;
00146     // Returns internal scaled parameters.
00147   inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
00148     // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
00149     // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
00150     // if not already scaled.
00151 
00152  public:  // without description
00153 
00154   G4Polyhedra(__void__&);
00155     // Fake default constructor for usage restricted to direct object
00156     // persistency for clients requiring preallocation of memory for
00157     // persistifiable objects.
00158 
00159   G4Polyhedra( const G4Polyhedra &source );
00160   const G4Polyhedra &operator=( const G4Polyhedra &source );
00161     // Copy constructor and assignment operator.
00162 
00163  protected:  // without description
00164 
00165   inline void SetOriginalParameters();
00166     // Sets internal parameters for the generic constructor.
00167 
00168   void Create( G4double phiStart,           // initial phi starting angle
00169                G4double phiTotal,           // total phi angle
00170                G4int    numSide,            // number sides
00171                G4ReduciblePolygon *rz );    // rz coordinates
00172     // Generates the shape and is called by each constructor, after the
00173     // conversion of the arguments
00174 
00175   void CopyStuff( const G4Polyhedra &source );
00176   void DeleteStuff();
00177 
00178   // Methods for generation of random points on surface
00179 
00180   G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1,
00181                                 G4ThreeVector p2, G4ThreeVector p3) const;
00182   G4ThreeVector GetPointOnTriangle(G4ThreeVector p0, G4ThreeVector p1,
00183                                    G4ThreeVector p2) const;
00184   G4ThreeVector GetPointOnSurfaceCorners() const;
00185 
00186  protected:  // without description
00187 
00188   G4int   numSide;      // Number of sides
00189   G4double startPhi;    // Starting phi value (0 < phiStart < 2pi)
00190   G4double endPhi;      // end phi value (0 < endPhi-phiStart < 2pi)
00191   G4bool   phiIsOpen;   // true if there is a phi segment
00192   G4bool   genericPgon; // true if created through the 2nd generic constructor
00193   G4int   numCorner;    // number RZ points
00194   G4PolyhedraSideRZ *corners;  // our corners
00195   G4PolyhedraHistorical  *original_parameters;  // original input parameters
00196 
00197   G4EnclosingCylinder *enclosingCylinder;
00198 
00199 };
00200 
00201 #include "G4Polyhedra.icc"
00202 
00203 #endif

Generated on Mon May 27 17:49:23 2013 for Geant4 by  doxygen 1.4.7