source: trunk/source/geometry/solids/CSG/include/G4Box.hh @ 1202

Last change on this file since 1202 was 1058, checked in by garnier, 15 years ago

file release beta

File size: 5.4 KB
Line 
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,v 1.17 2006/10/19 15:33:37 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30// --------------------------------------------------------------------
31// GEANT 4 class header file
32//
33//
34// G4Box
35//
36// Class description:
37//
38//   A Box is a cuboid of given half lengths dx,dy,dz. The Box is
39//   centred on the origin with sides parallel to the x/y/z axes.
40
41// History:
42// 30.06.95 P.Kent: Converted from source code developed end 94
43// 27.03.96 J.Allison: Added virtual functions DescribeYourselfTo() and
44//                     SendWireframeTo(G4VGraphicsModel&)
45// 22.07.96 J.Allison: Changed G4VGraphicsModel to G4VGraphicsScene
46//                     and SendPolyhedronTo() to CreatePolyhedron()
47// 27.03.98 J.Apostolakis: Inherit from G4CSGSolid (not G4VSolid)
48// 18.11.99 J.Apostolakis, V.Grichine: kUndefined was added to ESide
49// --------------------------------------------------------------------
50#ifndef G4BOX_HH
51#define G4BOX_HH
52
53#include "G4CSGSolid.hh"
54
55class G4Box : public G4CSGSolid
56{
57  public:  // with description
58
59    G4Box(const G4String& pName, G4double pX, G4double pY, G4double pZ);
60      // Construct a box with name, and half lengths pX,pY,pZ
61
62    virtual ~G4Box();
63
64
65    void ComputeDimensions(G4VPVParameterisation* p,
66                           const G4int n,
67                           const G4VPhysicalVolume* pRep);
68
69    G4bool CalculateExtent(const EAxis pAxis,
70                           const G4VoxelLimits& pVoxelLimit,
71                           const G4AffineTransform& pTransform,
72                                 G4double& pmin, G4double& pmax) const;
73
74  // Accessors and modifiers
75
76    inline G4double GetXHalfLength() const;
77    inline G4double GetYHalfLength() const;
78    inline G4double GetZHalfLength() const;
79
80    void SetXHalfLength(G4double dx) ;
81    void SetYHalfLength(G4double dy) ;
82    void SetZHalfLength(G4double dz) ;
83
84  // Methods for solid
85
86    inline G4double GetCubicVolume();
87    inline G4double GetSurfaceArea();
88
89    EInside Inside(const G4ThreeVector& p) const;
90    G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
91    G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
92    G4double DistanceToIn(const G4ThreeVector& p) const;
93    G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
94                           const G4bool calcNorm=false,
95                                 G4bool *validNorm=0, G4ThreeVector *n=0) const;
96    G4double DistanceToOut(const G4ThreeVector& p) const;
97
98    G4GeometryType GetEntityType() const;
99    G4ThreeVector GetPointOnSurface() const; 
100
101    std::ostream& StreamInfo(std::ostream& os) const;
102
103  // Functions for visualization
104
105    void          DescribeYourselfTo (G4VGraphicsScene& scene) const;
106    G4VisExtent   GetExtent          () const;
107    G4Polyhedron* CreatePolyhedron   () const;
108    G4NURBS*      CreateNURBS        () const;
109
110  public:  // without description
111
112    G4Box(__void__&);
113      // Fake default constructor for usage restricted to direct object
114      // persistency for clients requiring preallocation of memory for
115      // persistifiable objects.
116
117  protected:  // with description
118
119    G4ThreeVectorList*
120    CreateRotatedVertices(const G4AffineTransform& pTransform) const;
121      // Create the List of transformed vertices in the format required
122      // for G4VSolid:: ClipCrossSection and ClipBetweenSections.
123
124  protected:  // without description
125
126    enum ESide {kUndefined,kPX,kMX,kPY,kMY,kPZ,kMZ};
127      // Codes for faces (kPX=plus x face,kMY= minus y face etc)
128
129  private:
130
131    G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p) const;
132      // Algorithm for SurfaceNormal() following the original
133      // specification for points not on the surface
134
135  private:
136
137    G4double fDx,fDy,fDz;
138};
139
140#include "G4Box.icc"
141
142#endif
Note: See TracBrowser for help on using the repository browser.