Geant4  10.03
G4DisplacedSolid.hh
Go to the documentation of this file.
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: G4DisplacedSolid.hh 101046 2016-11-04 10:44:26Z gcosmo $
28 //
29 //
30 // class G4DisplacedSolid
31 //
32 // Class description:
33 //
34 // A displaced solid is a solid that has been shifted from its original
35 // frame of reference to a new one. It is meant to be used only for
36 // simplifying the implementation of "Boolean solids".
37 
38 // History:
39 //
40 // 28.10.98 V.Grichine: created
41 // 22.11.00 V.Grichine: new set methods for matrix/vectors
42 //
43 // --------------------------------------------------------------------
44 #ifndef G4DisplacedSolid_HH
45 #define G4DisplacedSolid_HH
46 
47 #include "G4VSolid.hh"
48 #include "G4RotationMatrix.hh"
49 #include "G4ThreeVector.hh"
50 #include "G4Transform3D.hh"
51 #include "G4AffineTransform.hh"
52 
53 class G4DisplacedSolid : public G4VSolid
54 {
55  public: // with description
56 
57  G4DisplacedSolid( const G4String& pName,
58  G4VSolid* pSolid ,
59  G4RotationMatrix* rotMatrix,
60  const G4ThreeVector& transVector ) ;
61 
62  G4DisplacedSolid( const G4String& pName,
63  G4VSolid* pSolid ,
64  const G4Transform3D& transform ) ;
65 
66  G4DisplacedSolid( const G4String& pName,
67  G4VSolid* pSolid ,
68  const G4AffineTransform directTransform );
69  // For use in instantiating a transient instance from a persistent one.
70 
71  virtual ~G4DisplacedSolid() ;
72 
73  public: // without description
74 
75  // It also has all the methods that a solid requires, eg.
76 
77  EInside Inside( const G4ThreeVector& p ) const ;
78 
79  void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
80 
81  G4bool CalculateExtent(const EAxis pAxis,
82  const G4VoxelLimits& pVoxelLimit,
83  const G4AffineTransform& pTransform,
84  G4double& pMin, G4double& pMax) const ;
85 
86  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const ;
87 
89  const G4ThreeVector& v ) const ;
90 
91  G4double DistanceToIn( const G4ThreeVector& p) const ;
92 
94  const G4ThreeVector& v,
95  const G4bool calcNorm=false,
96  G4bool *validNorm=0,
97  G4ThreeVector *n=0 ) const ;
98 
99  G4double DistanceToOut( const G4ThreeVector& p ) const ;
100 
101 
103  const G4int n,
104  const G4VPhysicalVolume* pRep ) ;
105 
106  void CleanTransformations();
107 
109 
110  public: // with description
111 
113  G4VSolid* Clone() const;
114 
115  const G4DisplacedSolid* GetDisplacedSolidPtr() const;
117  // If the Solid is a "G4DisplacedSolid",
118  // return a self pointer else return 0.
119 
121 
124 
127  // Access/Set methods.
128 
130  void SetFrameRotation(const G4RotationMatrix&);
131 
133  void SetFrameTranslation(const G4ThreeVector&);
134  // Get/Set the rotation/translation, as applied to the frame of reference.
135 
137  void SetObjectRotation(const G4RotationMatrix&);
138 
140  void SetObjectTranslation(const G4ThreeVector&);
141  // Get/Set the rotation/translation, as applied to the object.
142 
143  std::ostream& StreamInfo(std::ostream& os) const;
144 
145  public: // without description
146 
147  G4DisplacedSolid(__void__&);
148  // Fake default constructor for usage restricted to direct object
149  // persistency for clients requiring preallocation of memory for
150  // persistifiable objects.
151 
154  // Copy constructor and assignment operator.
155 
156  void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
157  G4Polyhedron* CreatePolyhedron () const ;
158  G4Polyhedron* GetPolyhedron () const ;
159  // For creating graphical representations (ie for visualisation).
160 
161  protected:
162 
168 } ;
169 
170 #endif
G4DisplacedSolid & operator=(const G4DisplacedSolid &rhs)
G4Polyhedron * GetPolyhedron() const
virtual ~G4DisplacedSolid()
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
G4ThreeVector GetFrameTranslation() const
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4RotationMatrix GetObjectRotation() const
const G4DisplacedSolid * GetDisplacedSolidPtr() const
G4AffineTransform GetDirectTransform() const
G4Polyhedron * CreatePolyhedron() const
int G4int
Definition: G4Types.hh:78
G4VSolid * Clone() const
G4ThreeVector GetObjectTranslation() const
G4RotationMatrix GetFrameRotation() const
void SetDirectTransform(G4AffineTransform &)
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
void SetFrameTranslation(const G4ThreeVector &)
bool G4bool
Definition: G4Types.hh:79
G4DisplacedSolid(const G4String &pName, G4VSolid *pSolid, G4RotationMatrix *rotMatrix, const G4ThreeVector &transVector)
HepGeom::Transform3D G4Transform3D
const G4int n
G4GeometryType GetEntityType() const
G4AffineTransform GetTransform() const
G4AffineTransform * fPtrTransform
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
EInside
Definition: geomdefs.hh:58
G4VSolid * GetConstituentMovedSolid() const
EAxis
Definition: geomdefs.hh:54
G4Polyhedron * fpPolyhedron
G4AffineTransform * fDirectTransform
void SetObjectTranslation(const G4ThreeVector &)
void SetTransform(G4AffineTransform &)
double G4double
Definition: G4Types.hh:76
std::ostream & StreamInfo(std::ostream &os) const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
void SetObjectRotation(const G4RotationMatrix &)
void SetFrameRotation(const G4RotationMatrix &)
G4ThreeVector GetPointOnSurface() const
void DescribeYourselfTo(G4VGraphicsScene &scene) const
EInside Inside(const G4ThreeVector &p) const