G4Trd.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: G4Trd.hh 69788 2013-05-15 12:06:57Z gcosmo $
00028 //
00029 // 
00030 // --------------------------------------------------------------------
00031 // GEANT 4 class header file
00032 //
00033 //
00034 // G4Trd
00035 //
00036 // Class description:
00037 //
00038 //   A G4Trd is a trapezoid with the x and y dimensions varying along z
00039 //   functions:
00040 //
00041 //   Member Data:
00042 //
00043 //     fDx1    Half-length along x at the surface positioned at -dz
00044 //     fDx2    Half-length along x at the surface positioned at +dz
00045 //     fDy1    Half-length along y at the surface positioned at -dz
00046 //     fDy2    Half-length along y at the surface positioned at +dz
00047 //     fDz     Half-length along z axis
00048 
00049 // History:
00050 // 12.01.95 P.Kent: Old prototype code converted to thick geometry
00051 // 17.02.95 P.Kent: Exiting normal return
00052 // 19.08.96 P.Kent, V.Grichine: Fs in accordance with G4Box
00053 // 21.04.97 J.Apostolakis: Added Set Methods
00054 // 19.11.99 V.Grichine: kUndefined was added to Eside enum 
00055 // --------------------------------------------------------------------
00056 
00057 #ifndef G4TRD_HH
00058 #define G4TRD_HH
00059 
00060 #include "G4CSGSolid.hh"
00061 
00062 class G4Trd : public G4CSGSolid 
00063 {
00064   public:  // with description
00065 
00066     G4Trd( const G4String& pName,
00067                  G4double pdx1, G4double pdx2,
00068                  G4double pdy1, G4double pdy2,
00069                  G4double pdz );
00070       //
00071       // Constructs a trapezoid with name, and half lengths
00072 
00073    ~G4Trd();
00074       //
00075       // Destructor
00076 
00077     // Accessors
00078 
00079     inline G4double GetXHalfLength1() const;
00080     inline G4double GetXHalfLength2() const;
00081     inline G4double GetYHalfLength1() const;
00082     inline G4double GetYHalfLength2() const;
00083     inline G4double GetZHalfLength()  const;
00084 
00085     // Modifiers
00086 
00087     inline void SetXHalfLength1(G4double val);
00088     inline void SetXHalfLength2(G4double val);
00089     inline void SetYHalfLength1(G4double val);
00090     inline void SetYHalfLength2(G4double val);
00091     inline void SetZHalfLength(G4double val);
00092 
00093     // Methods of solid
00094 
00095     inline G4double GetCubicVolume();
00096     inline G4double GetSurfaceArea();
00097 
00098     void ComputeDimensions(       G4VPVParameterisation* p,
00099                             const G4int n,
00100                             const G4VPhysicalVolume* pRep );
00101 
00102     G4bool CalculateExtent( const EAxis pAxis,
00103                             const G4VoxelLimits& pVoxelLimit,
00104                             const G4AffineTransform& pTransform,
00105                                   G4double& pMin, G4double& pMax ) const;
00106 
00107     EInside Inside( const G4ThreeVector& p ) const;
00108 
00109     G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
00110 
00111     G4double DistanceToIn( const G4ThreeVector& p,
00112                            const G4ThreeVector& v ) const;
00113 
00114     G4double DistanceToIn( const G4ThreeVector& p ) const;
00115 
00116     G4double DistanceToOut( const G4ThreeVector& p,
00117                             const G4ThreeVector& v,
00118                             const G4bool calcNorm=false,
00119                                   G4bool *validNorm=0,
00120                                   G4ThreeVector *n=0 ) const;
00121 
00122     G4double DistanceToOut( const G4ThreeVector& p ) const;
00123 
00124     void CheckAndSetAllParameters ( G4double pdx1, G4double pdx2,
00125                                     G4double pdy1, G4double pdy2,
00126                                     G4double pdz );
00127 
00128     void SetAllParameters ( G4double pdx1, G4double pdx2,
00129                             G4double pdy1, G4double pdy2,
00130                             G4double pdz );
00131 
00132     G4GeometryType GetEntityType() const;
00133 
00134     G4ThreeVector GetPointOnSurface() const; 
00135 
00136     G4VSolid* Clone() const;
00137 
00138     std::ostream& StreamInfo( std::ostream& os ) const;
00139 
00140     // Visualisation functions
00141 
00142     void          DescribeYourselfTo (G4VGraphicsScene& scene) const;
00143     G4Polyhedron* CreatePolyhedron   () const;
00144     G4NURBS*      CreateNURBS        () const;
00145 
00146   public:  // without description
00147 
00148     enum ESide {kUndefined, kPX,kMX,kPY,kMY,kPZ,kMZ};
00149       // Codes for faces (kPX=plus x face,kMY= minus y face etc)
00150 
00151     G4Trd(__void__&);
00152       // Fake default constructor for usage restricted to direct object
00153       // persistency for clients requiring preallocation of memory for
00154       // persistifiable objects.
00155 
00156     G4Trd(const G4Trd& rhs);
00157     G4Trd& operator=(const G4Trd& rhs); 
00158       // Copy constructor and assignment operator.
00159 
00160     G4ThreeVectorList*
00161     CreateRotatedVertices( const G4AffineTransform& pTransform ) const;
00162       //
00163       // Creates the List of transformed vertices in the format required
00164       // for G4CSGSolid:: ClipCrossSection and ClipBetweenSections
00165 
00166     G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
00167       // Algorithm for SurfaceNormal() following the original
00168       // specification for points not on the surface
00169 
00170   private:
00171 
00172     G4double fDx1,fDx2,fDy1,fDy2,fDz;
00173 };
00174 
00175 #include "G4Trd.icc"
00176 
00177 #endif

Generated on Mon May 27 17:50:03 2013 for Geant4 by  doxygen 1.4.7