Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4Box.hh
이 파일의 문서화 페이지로 가기
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: G4Box.hh 104316 2017-05-24 13:04:23Z gcosmo $
28 //
29 // --------------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 //
33 // G4Box
34 //
35 // Class description:
36 //
37 // A Box is a cuboid of given half lengths dx,dy,dz. The Box is
38 // centred on the origin with sides parallel to the x/y/z axes.
39 
40 // History:
41 // 30.06.95 P.Kent: Converted from source code developed end 94
42 // 27.03.96 J.Allison: Added virtual functions DescribeYourselfTo() and
43 // SendWireframeTo(G4VGraphicsModel&)
44 // 22.07.96 J.Allison: Changed G4VGraphicsModel to G4VGraphicsScene
45 // and SendPolyhedronTo() to CreatePolyhedron()
46 // 27.03.98 J.Apostolakis: Inherit from G4CSGSolid (not G4VSolid)
47 // 18.11.99 J.Apostolakis, V.Grichine: kUndefined was added to ESide
48 // --------------------------------------------------------------------
49 #ifndef G4BOX_HH
50 #define G4BOX_HH
51 
52 #if defined(G4GEOM_USE_USOLIDS)
53 #define G4GEOM_USE_UBOX 1
54 #endif
55 
56 #if defined(G4GEOM_USE_UBOX)
57  #define G4UBox G4Box
58  #include "G4UBox.hh"
59 #else
60 
61 #include "G4CSGSolid.hh"
62 #include "G4Polyhedron.hh"
63 
64 class G4Box : public G4CSGSolid
65 {
66  public: // with description
67 
68  G4Box(const G4String& pName, G4double pX, G4double pY, G4double pZ);
69  // Construct a box with name, and half lengths pX,pY,pZ
70 
71  virtual ~G4Box();
72 
73 
75  const G4int n,
76  const G4VPhysicalVolume* pRep);
77 
78  void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
79 
80  G4bool CalculateExtent(const EAxis pAxis,
81  const G4VoxelLimits& pVoxelLimit,
82  const G4AffineTransform& pTransform,
83  G4double& pMin, G4double& pMax) const;
84 
85  // Accessors and modifiers
86 
87  inline G4double GetXHalfLength() const;
88  inline G4double GetYHalfLength() const;
89  inline G4double GetZHalfLength() const;
90 
91  void SetXHalfLength(G4double dx) ;
92  void SetYHalfLength(G4double dy) ;
93  void SetZHalfLength(G4double dz) ;
94 
95  // Methods for solid
96 
97  inline G4double GetCubicVolume();
98  inline G4double GetSurfaceArea();
99 
100  EInside Inside(const G4ThreeVector& p) const;
101  G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
102  G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
103  G4double DistanceToIn(const G4ThreeVector& p) const;
105  const G4bool calcNorm=false,
106  G4bool *validNorm=0, G4ThreeVector *n=0) const;
107  G4double DistanceToOut(const G4ThreeVector& p) const;
108 
111 
112  G4VSolid* Clone() const;
113 
114  std::ostream& StreamInfo(std::ostream& os) const;
115 
116  // Utilities for visualization
117 
118  void DescribeYourselfTo (G4VGraphicsScene& scene) const;
119  G4VisExtent GetExtent () const;
120  G4Polyhedron* CreatePolyhedron () const;
121 
122  public: // without description
123 
124  G4Box(__void__&);
125  // Fake default constructor for usage restricted to direct object
126  // persistency for clients requiring preallocation of memory for
127  // persistifiable objects.
128 
129  G4Box(const G4Box& rhs);
130  G4Box& operator=(const G4Box& rhs);
131  // Copy constructor and assignment operator.
132 
133  private:
134 
136  // Algorithm for SurfaceNormal() following the original
137  // specification for points not on the surface
138 
139  private:
140 
142  G4double delta; // Cached half Cartesian tolerance
143 };
144 
145 #include "G4Box.icc"
146 
147 #endif
148 
149 #endif
void SetXHalfLength(G4double dx)
Definition: G4Box.cc:136
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
Definition: G4Box.cc:274
G4double GetYHalfLength() const
EInside Inside(const G4ThreeVector &p) const
Definition: G4Box.cc:260
G4Polyhedron * CreatePolyhedron() const
Definition: G4Box.cc:557
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Box.cc:336
G4Box(const G4String &pName, G4double pX, G4double pY, G4double pZ)
Definition: G4Box.cc:63
G4VSolid * Clone() const
Definition: G4Box.cc:538
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Box.cc:491
const char * p
Definition: xmltok.h:285
void SetZHalfLength(G4double dz)
Definition: G4Box.cc:183
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
Definition: G4Box.cc:388
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Box.cc:207
G4Box & operator=(const G4Box &rhs)
Definition: G4Box.cc:112
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
Definition: G4Box.cc:241
G4VisExtent GetExtent() const
Definition: G4Box.cc:552
G4double fDx
Definition: G4Box.hh:141
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4double GetSurfaceArea()
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4Box.cc:316
Definition: G4Box.hh:64
void DescribeYourselfTo(G4VGraphicsScene &scene) const
Definition: G4Box.cc:547
G4GeometryType GetEntityType() const
Definition: G4Box.cc:482
G4double GetXHalfLength() const
void SetYHalfLength(G4double dy)
Definition: G4Box.cc:160
int G4int
Definition: G4Types.hh:78
EInside
Definition: geomdefs.hh:58
G4double fDz
Definition: G4Box.hh:141
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Box.cc:218
EAxis
Definition: geomdefs.hh:54
G4double delta
Definition: G4Box.hh:142
G4ThreeVector GetPointOnSurface() const
Definition: G4Box.cc:514
Char_t n[5]
G4double GetCubicVolume()
virtual ~G4Box()
Definition: G4Box.cc:95
G4double GetZHalfLength() const
G4double fDy
Definition: G4Box.hh:141