| [831] | 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,v 1.19 2006/06/29 18:43:31 gunter Exp $
|
|---|
| [1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $
|
|---|
| [831] | 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // class G4DisplacedSolid
|
|---|
| 32 | //
|
|---|
| 33 | // Class description:
|
|---|
| 34 | //
|
|---|
| 35 | // A displaced solid is a solid that has been shifted from its original
|
|---|
| 36 | // frame of reference to a new one. It is meant to be used only for
|
|---|
| 37 | // simplifying the implementation of "Boolean solids".
|
|---|
| 38 |
|
|---|
| 39 | // History:
|
|---|
| 40 | //
|
|---|
| 41 | // 28.10.98 V.Grichine: created
|
|---|
| 42 | // 22.11.00 V.Grichine: new set methods for matrix/vectors
|
|---|
| 43 | //
|
|---|
| 44 | // --------------------------------------------------------------------
|
|---|
| 45 | #ifndef G4DisplacedSolid_HH
|
|---|
| 46 | #define G4DisplacedSolid_HH
|
|---|
| 47 |
|
|---|
| 48 | #include "G4VSolid.hh"
|
|---|
| 49 | #include "G4RotationMatrix.hh"
|
|---|
| 50 | #include "G4ThreeVector.hh"
|
|---|
| 51 | #include "G4Transform3D.hh"
|
|---|
| 52 | #include "G4AffineTransform.hh"
|
|---|
| 53 |
|
|---|
| 54 | class G4DisplacedSolid : public G4VSolid
|
|---|
| 55 | {
|
|---|
| 56 | public: // with description
|
|---|
| 57 |
|
|---|
| 58 | G4DisplacedSolid( const G4String& pName,
|
|---|
| 59 | G4VSolid* pSolid ,
|
|---|
| 60 | G4RotationMatrix* rotMatrix,
|
|---|
| 61 | const G4ThreeVector& transVector ) ;
|
|---|
| 62 |
|
|---|
| 63 | G4DisplacedSolid( const G4String& pName,
|
|---|
| 64 | G4VSolid* pSolid ,
|
|---|
| 65 | const G4Transform3D& transform ) ;
|
|---|
| 66 |
|
|---|
| 67 | G4DisplacedSolid( const G4String& pName,
|
|---|
| 68 | G4VSolid* pSolid ,
|
|---|
| 69 | const G4AffineTransform directTransform );
|
|---|
| 70 | // For use in instantiating a transient instance from a persistent one.
|
|---|
| 71 |
|
|---|
| 72 | virtual ~G4DisplacedSolid() ;
|
|---|
| 73 |
|
|---|
| 74 | public: // without description
|
|---|
| 75 |
|
|---|
| 76 | // It also has all the methods that a solid requires, eg.
|
|---|
| 77 |
|
|---|
| 78 | EInside Inside( const G4ThreeVector& p ) const ;
|
|---|
| 79 |
|
|---|
| 80 | G4bool CalculateExtent(const EAxis pAxis,
|
|---|
| 81 | const G4VoxelLimits& pVoxelLimit,
|
|---|
| 82 | const G4AffineTransform& pTransform,
|
|---|
| 83 | G4double& pMin, G4double& pMax) const ;
|
|---|
| 84 |
|
|---|
| 85 | G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const ;
|
|---|
| 86 |
|
|---|
| 87 | G4double DistanceToIn( const G4ThreeVector& p,
|
|---|
| 88 | const G4ThreeVector& v ) const ;
|
|---|
| 89 |
|
|---|
| 90 | G4double DistanceToIn( const G4ThreeVector& p) const ;
|
|---|
| 91 |
|
|---|
| 92 | G4double DistanceToOut( const G4ThreeVector& p,
|
|---|
| 93 | const G4ThreeVector& v,
|
|---|
| 94 | const G4bool calcNorm=false,
|
|---|
| 95 | G4bool *validNorm=0,
|
|---|
| 96 | G4ThreeVector *n=0 ) const ;
|
|---|
| 97 |
|
|---|
| 98 | G4double DistanceToOut( const G4ThreeVector& p ) const ;
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 | void ComputeDimensions( G4VPVParameterisation* p,
|
|---|
| 102 | const G4int n,
|
|---|
| 103 | const G4VPhysicalVolume* pRep ) ;
|
|---|
| 104 |
|
|---|
| 105 | void CleanTransformations();
|
|---|
| 106 |
|
|---|
| 107 | G4ThreeVector GetPointOnSurface() const;
|
|---|
| 108 |
|
|---|
| 109 | public: // with description
|
|---|
| 110 |
|
|---|
| 111 | virtual G4GeometryType GetEntityType() const;
|
|---|
| 112 |
|
|---|
| 113 | virtual const G4DisplacedSolid* GetDisplacedSolidPtr() const ;
|
|---|
| 114 | virtual G4DisplacedSolid* GetDisplacedSolidPtr();
|
|---|
| 115 | // If the Solid is a "G4DisplacedSolid",
|
|---|
| 116 | // return a self pointer else return 0.
|
|---|
| 117 |
|
|---|
| 118 | G4VSolid* GetConstituentMovedSolid() const;
|
|---|
| 119 |
|
|---|
| 120 | G4AffineTransform GetTransform() const;
|
|---|
| 121 | void SetTransform(G4AffineTransform& );
|
|---|
| 122 |
|
|---|
| 123 | G4AffineTransform GetDirectTransform() const;
|
|---|
| 124 | void SetDirectTransform(G4AffineTransform&);
|
|---|
| 125 | // Access/Set methods.
|
|---|
| 126 |
|
|---|
| 127 | G4RotationMatrix GetFrameRotation() const;
|
|---|
| 128 | void SetFrameRotation(const G4RotationMatrix&);
|
|---|
| 129 |
|
|---|
| 130 | G4ThreeVector GetFrameTranslation() const;
|
|---|
| 131 | void SetFrameTranslation(const G4ThreeVector&);
|
|---|
| 132 | // Get/Set the rotation/translation, as applied to the frame of reference.
|
|---|
| 133 |
|
|---|
| 134 | G4RotationMatrix GetObjectRotation() const;
|
|---|
| 135 | void SetObjectRotation(const G4RotationMatrix&);
|
|---|
| 136 |
|
|---|
| 137 | G4ThreeVector GetObjectTranslation() const;
|
|---|
| 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 |
|
|---|
| 150 | void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
|
|---|
| 151 | G4Polyhedron* CreatePolyhedron () const ;
|
|---|
| 152 | G4NURBS* CreateNURBS () const ;
|
|---|
| 153 | virtual G4Polyhedron* GetPolyhedron () const;
|
|---|
| 154 | // For creating graphical representations (ie for visualisation).
|
|---|
| 155 |
|
|---|
| 156 | protected:
|
|---|
| 157 |
|
|---|
| 158 | G4VSolid* fPtrSolid ;
|
|---|
| 159 | G4AffineTransform* fPtrTransform ;
|
|---|
| 160 | G4AffineTransform* fDirectTransform ;
|
|---|
| 161 | mutable G4Polyhedron* fpPolyhedron;
|
|---|
| 162 |
|
|---|
| 163 | private:
|
|---|
| 164 |
|
|---|
| 165 | G4DisplacedSolid(const G4DisplacedSolid&);
|
|---|
| 166 | G4DisplacedSolid& operator=(const G4DisplacedSolid&);
|
|---|
| 167 | // Private copy constructor and assignment operator.
|
|---|
| 168 | } ;
|
|---|
| 169 |
|
|---|
| 170 | #endif
|
|---|