G4Box.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: G4Box.hh 69788 2013-05-15 12:06:57Z gcosmo $
00028 //
00029 // --------------------------------------------------------------------
00030 // GEANT 4 class header file
00031 //
00032 // 
00033 // G4Box
00034 //
00035 // Class description:
00036 //
00037 //   A Box is a cuboid of given half lengths dx,dy,dz. The Box is
00038 //   centred on the origin with sides parallel to the x/y/z axes.
00039 
00040 // History:
00041 // 30.06.95 P.Kent: Converted from source code developed end 94
00042 // 27.03.96 J.Allison: Added virtual functions DescribeYourselfTo() and
00043 //                     SendWireframeTo(G4VGraphicsModel&)
00044 // 22.07.96 J.Allison: Changed G4VGraphicsModel to G4VGraphicsScene
00045 //                     and SendPolyhedronTo() to CreatePolyhedron()
00046 // 27.03.98 J.Apostolakis: Inherit from G4CSGSolid (not G4VSolid)
00047 // 18.11.99 J.Apostolakis, V.Grichine: kUndefined was added to ESide
00048 // --------------------------------------------------------------------
00049 #ifndef G4BOX_HH
00050 #define G4BOX_HH
00051 
00052 #include "G4CSGSolid.hh"
00053 
00054 class G4Box : public G4CSGSolid 
00055 {
00056   public:  // with description
00057 
00058     G4Box(const G4String& pName, G4double pX, G4double pY, G4double pZ);
00059       // Construct a box with name, and half lengths pX,pY,pZ
00060 
00061     virtual ~G4Box();
00062 
00063 
00064     void ComputeDimensions(G4VPVParameterisation* p,
00065                            const G4int n,
00066                            const G4VPhysicalVolume* pRep);
00067 
00068     G4bool CalculateExtent(const EAxis pAxis,
00069                            const G4VoxelLimits& pVoxelLimit,
00070                            const G4AffineTransform& pTransform,
00071                                  G4double& pmin, G4double& pmax) const;
00072 
00073   // Accessors and modifiers
00074 
00075     inline G4double GetXHalfLength() const;
00076     inline G4double GetYHalfLength() const;
00077     inline G4double GetZHalfLength() const;
00078 
00079     void SetXHalfLength(G4double dx) ;
00080     void SetYHalfLength(G4double dy) ;
00081     void SetZHalfLength(G4double dz) ;
00082 
00083   // Methods for solid
00084 
00085     inline G4double GetCubicVolume();
00086     inline G4double GetSurfaceArea();
00087 
00088     EInside Inside(const G4ThreeVector& p) const;
00089     G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
00090     G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
00091     G4double DistanceToIn(const G4ThreeVector& p) const;
00092     G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
00093                            const G4bool calcNorm=false,
00094                                  G4bool *validNorm=0, G4ThreeVector *n=0) const;
00095     G4double DistanceToOut(const G4ThreeVector& p) const;
00096 
00097     G4GeometryType GetEntityType() const;
00098     G4ThreeVector GetPointOnSurface() const; 
00099 
00100     G4VSolid* Clone() const;
00101 
00102     std::ostream& StreamInfo(std::ostream& os) const;
00103 
00104   // Utilities for visualization
00105 
00106     void          DescribeYourselfTo (G4VGraphicsScene& scene) const;
00107     G4VisExtent   GetExtent          () const;
00108     G4Polyhedron* CreatePolyhedron   () const;
00109     G4NURBS*      CreateNURBS        () const;
00110 
00111   public:  // without description
00112 
00113     G4Box(__void__&);
00114       // Fake default constructor for usage restricted to direct object
00115       // persistency for clients requiring preallocation of memory for
00116       // persistifiable objects.
00117 
00118     G4Box(const G4Box& rhs);
00119     G4Box& operator=(const G4Box& rhs); 
00120       // Copy constructor and assignment operator.
00121 
00122   protected:  // with description
00123 
00124     G4ThreeVectorList*
00125     CreateRotatedVertices(const G4AffineTransform& pTransform) const;
00126       // Create the List of transformed vertices in the format required
00127       // for G4VSolid:: ClipCrossSection and ClipBetweenSections.
00128 
00129   protected:  // without description
00130 
00131     enum ESide {kUndefined,kPX,kMX,kPY,kMY,kPZ,kMZ};
00132       // Codes for faces (kPX= +x face, kMY= -y face, etc...)
00133 
00134   private:
00135 
00136     G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
00137       // Algorithm for SurfaceNormal() following the original
00138       // specification for points not on the surface
00139 
00140   private:
00141 
00142     G4double fDx,fDy,fDz;
00143 };
00144 
00145 #include "G4Box.icc"
00146 
00147 #endif

Generated on Mon May 27 17:47:46 2013 for Geant4 by  doxygen 1.4.7