Geant4  10.02.p01
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 83572 2014-09-01 15:23:27Z 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  G4bool CalculateExtent(const EAxis pAxis,
80  const G4VoxelLimits& pVoxelLimit,
81  const G4AffineTransform& pTransform,
82  G4double& pMin, G4double& pMax) const ;
83 
84  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const ;
85 
87  const G4ThreeVector& v ) const ;
88 
89  G4double DistanceToIn( const G4ThreeVector& p) const ;
90 
92  const G4ThreeVector& v,
93  const G4bool calcNorm=false,
94  G4bool *validNorm=0,
95  G4ThreeVector *n=0 ) const ;
96 
97  G4double DistanceToOut( const G4ThreeVector& p ) const ;
98 
99 
101  const G4int n,
102  const G4VPhysicalVolume* pRep ) ;
103 
104  void CleanTransformations();
105 
107 
108  public: // with description
109 
111  G4VSolid* Clone() const;
112 
113  const G4DisplacedSolid* GetDisplacedSolidPtr() const;
115  // If the Solid is a "G4DisplacedSolid",
116  // return a self pointer else return 0.
117 
119 
122 
125  // Access/Set methods.
126 
128  void SetFrameRotation(const G4RotationMatrix&);
129 
131  void SetFrameTranslation(const G4ThreeVector&);
132  // Get/Set the rotation/translation, as applied to the frame of reference.
133 
135  void SetObjectRotation(const G4RotationMatrix&);
136 
138  void SetObjectTranslation(const G4ThreeVector&);
139  // Get/Set the rotation/translation, as applied to the object.
140 
141  std::ostream& StreamInfo(std::ostream& os) const;
142 
143  public: // without description
144 
145  G4DisplacedSolid(__void__&);
146  // Fake default constructor for usage restricted to direct object
147  // persistency for clients requiring preallocation of memory for
148  // persistifiable objects.
149 
152  // Copy constructor and assignment operator.
153 
154  void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
155  G4Polyhedron* CreatePolyhedron () const ;
156  G4Polyhedron* GetPolyhedron () const ;
157  // For creating graphical representations (ie for visualisation).
158 
159  protected:
160 
166 } ;
167 
168 #endif
G4DisplacedSolid & operator=(const G4DisplacedSolid &rhs)
G4Polyhedron * GetPolyhedron() const
virtual ~G4DisplacedSolid()
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
G4ThreeVector GetFrameTranslation() 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