Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:06

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4DisplacedSolid
0027 //
0028 // Class description:
0029 //
0030 // A displaced solid is a solid that has been shifted from its original
0031 // frame of reference to a new one. It is meant to be used only for
0032 // simplifying the implementation of "Boolean solids". 
0033 
0034 // 28.10.98 V.Grichine - created
0035 // --------------------------------------------------------------------
0036 #ifndef G4DISPLACEDSOLID_HH
0037 #define G4DISPLACEDSOLID_HH
0038 
0039 #include "G4VSolid.hh"
0040 #include "G4RotationMatrix.hh"
0041 #include "G4ThreeVector.hh"
0042 #include "G4Transform3D.hh"
0043 #include "G4AffineTransform.hh"
0044 
0045 class G4DisplacedSolid : public G4VSolid
0046 {
0047   public:
0048 
0049     G4DisplacedSolid( const G4String& pName,
0050                             G4VSolid* pSolid ,
0051                             G4RotationMatrix* rotMatrix,
0052                       const G4ThreeVector& transVector  ) ;
0053 
0054     G4DisplacedSolid( const G4String& pName,
0055                             G4VSolid* pSolid ,
0056                       const G4Transform3D& transform  ) ;
0057 
0058     G4DisplacedSolid( const G4String& pName,
0059                             G4VSolid* pSolid ,
0060                       const G4AffineTransform directTransform );
0061       // For use in instantiating a transient instance from a persistent one.
0062 
0063     ~G4DisplacedSolid() override ;
0064 
0065     EInside Inside( const G4ThreeVector& p ) const override ; 
0066 
0067     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0068 
0069     G4bool CalculateExtent(const EAxis pAxis,
0070                            const G4VoxelLimits& pVoxelLimit,
0071                            const G4AffineTransform& pTransform,
0072                                  G4double& pMin, G4double& pMax) const override ;
0073 
0074     G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override ;
0075 
0076     G4double DistanceToIn( const G4ThreeVector& p,
0077                            const G4ThreeVector& v  ) const override ;
0078 
0079     G4double DistanceToIn( const G4ThreeVector& p) const override ;
0080 
0081     G4double DistanceToOut( const G4ThreeVector& p,
0082                             const G4ThreeVector& v,
0083                             const G4bool calcNorm=false,
0084                                   G4bool *validNorm=nullptr,
0085                                   G4ThreeVector *n=nullptr ) const override ;
0086 
0087     G4double DistanceToOut( const G4ThreeVector& p ) const override ;
0088 
0089 
0090     void ComputeDimensions(       G4VPVParameterisation* p,
0091                             const G4int n,
0092                             const G4VPhysicalVolume* pRep ) override ;
0093 
0094     void CleanTransformations();
0095 
0096     G4double GetCubicVolume() override;
0097     G4double GetSurfaceArea() override;
0098 
0099     G4ThreeVector GetPointOnSurface() const override;
0100 
0101     G4GeometryType  GetEntityType() const override;
0102     G4VSolid* Clone() const override;
0103 
0104     const G4DisplacedSolid* GetDisplacedSolidPtr() const override;
0105           G4DisplacedSolid* GetDisplacedSolidPtr() override;
0106       // If the Solid is a "G4DisplacedSolid",
0107       // return a self pointer else return 0.
0108 
0109     G4VSolid* GetConstituentMovedSolid() const;
0110 
0111     G4AffineTransform GetTransform() const; 
0112     void       SetTransform(G4AffineTransform& ); 
0113 
0114     G4AffineTransform GetDirectTransform() const; 
0115     void       SetDirectTransform(G4AffineTransform&); 
0116       // Access/Set methods.
0117 
0118     G4RotationMatrix GetFrameRotation() const;
0119     void SetFrameRotation(const G4RotationMatrix&);
0120 
0121     G4ThreeVector GetFrameTranslation() const; 
0122     void SetFrameTranslation(const G4ThreeVector&); 
0123       // Get/Set the rotation/translation, as applied to the frame of reference.
0124 
0125     G4RotationMatrix GetObjectRotation() const;
0126     void SetObjectRotation(const G4RotationMatrix&);
0127 
0128     G4ThreeVector GetObjectTranslation() const; 
0129     void SetObjectTranslation(const G4ThreeVector&); 
0130       // Get/Set the rotation/translation, as applied to the object.
0131 
0132     std::ostream& StreamInfo(std::ostream& os) const override;
0133 
0134     G4DisplacedSolid(__void__&);
0135       // Fake default constructor for usage restricted to direct object
0136       // persistency for clients requiring preallocation of memory for
0137       // persistifiable objects.
0138 
0139     G4DisplacedSolid(const G4DisplacedSolid& rhs);
0140     G4DisplacedSolid& operator=(const G4DisplacedSolid& rhs);
0141       // Copy constructor and assignment operator.
0142 
0143     void DescribeYourselfTo ( G4VGraphicsScene& scene ) const override ;
0144     G4Polyhedron* CreatePolyhedron () const override ;
0145     G4Polyhedron* GetPolyhedron () const override ;
0146       // For creating graphical representations (ie for visualisation).
0147 
0148   protected:
0149 
0150     G4VSolid* fPtrSolid = nullptr;
0151     G4AffineTransform* fPtrTransform = nullptr;
0152     G4AffineTransform* fDirectTransform = nullptr;
0153     mutable G4bool fRebuildPolyhedron = false;
0154     mutable G4Polyhedron* fpPolyhedron = nullptr;
0155 };
0156 
0157 #endif