G4DisplacedSolid.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //
00030 // class G4DisplacedSolid
00031 //
00032 // Class description:
00033 //
00034 // A displaced solid is a solid that has been shifted from its original
00035 // frame of reference to a new one. It is meant to be used only for
00036 // simplifying the implementation of "Boolean solids". 
00037 
00038 // History:
00039 //
00040 // 28.10.98 V.Grichine: created
00041 // 22.11.00 V.Grichine: new set methods for matrix/vectors
00042 //
00043 // --------------------------------------------------------------------
00044 #ifndef G4DisplacedSolid_HH
00045 #define G4DisplacedSolid_HH
00046 
00047 #include "G4VSolid.hh"
00048 #include "G4RotationMatrix.hh"
00049 #include "G4ThreeVector.hh"
00050 #include "G4Transform3D.hh"
00051 #include "G4AffineTransform.hh"
00052 
00053 class G4DisplacedSolid : public G4VSolid
00054 {
00055   public:  // with description
00056 
00057     G4DisplacedSolid( const G4String& pName,
00058                             G4VSolid* pSolid ,
00059                             G4RotationMatrix* rotMatrix,
00060                       const G4ThreeVector& transVector  ) ;
00061 
00062     G4DisplacedSolid( const G4String& pName,
00063                             G4VSolid* pSolid ,
00064                       const G4Transform3D& transform  ) ;
00065 
00066     G4DisplacedSolid( const G4String& pName,
00067                             G4VSolid* pSolid ,
00068                       const G4AffineTransform directTransform );
00069       // For use in instantiating a transient instance from a persistent one.
00070 
00071     virtual ~G4DisplacedSolid() ;
00072 
00073   public:  // without description 
00074 
00075     // It also has all the methods that a solid requires, eg.
00076 
00077     EInside Inside( const G4ThreeVector& p ) const ; 
00078 
00079     G4bool CalculateExtent(const EAxis pAxis,
00080                            const G4VoxelLimits& pVoxelLimit,
00081                            const G4AffineTransform& pTransform,
00082                                  G4double& pMin, G4double& pMax) const ;
00083 
00084     G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const ;
00085 
00086     G4double DistanceToIn( const G4ThreeVector& p,
00087                            const G4ThreeVector& v  ) const ;
00088 
00089     G4double DistanceToIn( const G4ThreeVector& p) const ;
00090 
00091     G4double DistanceToOut( const G4ThreeVector& p,
00092                             const G4ThreeVector& v,
00093                             const G4bool calcNorm=false,
00094                                   G4bool *validNorm=0,
00095                                   G4ThreeVector *n=0      ) const ;
00096 
00097     G4double DistanceToOut( const G4ThreeVector& p ) const ;
00098 
00099 
00100     void ComputeDimensions(       G4VPVParameterisation* p,
00101                             const G4int n,
00102                             const G4VPhysicalVolume* pRep ) ;
00103 
00104     void CleanTransformations();
00105 
00106     G4ThreeVector GetPointOnSurface() const;
00107 
00108   public:  // with description 
00109 
00110     G4GeometryType  GetEntityType() const;
00111     G4VSolid* Clone() const;
00112 
00113     const G4DisplacedSolid* GetDisplacedSolidPtr() const;
00114           G4DisplacedSolid* GetDisplacedSolidPtr();
00115       // If the Solid is a "G4DisplacedSolid",
00116       // return a self pointer else return 0.
00117 
00118     G4VSolid*                GetConstituentMovedSolid() const;
00119 
00120     G4AffineTransform        GetTransform() const; 
00121     void       SetTransform(G4AffineTransform& ); 
00122 
00123     G4AffineTransform        GetDirectTransform() const; 
00124     void       SetDirectTransform(G4AffineTransform&); 
00125       // Access/Set methods.
00126 
00127     G4RotationMatrix         GetFrameRotation() const;
00128     void  SetFrameRotation(const G4RotationMatrix&);
00129 
00130     G4ThreeVector            GetFrameTranslation() const; 
00131     void  SetFrameTranslation(const G4ThreeVector&); 
00132       // Get/Set the rotation/translation, as applied to the frame of reference.
00133 
00134     G4RotationMatrix         GetObjectRotation() const;
00135     void  SetObjectRotation(const G4RotationMatrix&);
00136 
00137     G4ThreeVector            GetObjectTranslation() const; 
00138     void  SetObjectTranslation(const G4ThreeVector&); 
00139       // Get/Set the rotation/translation, as applied to the object.
00140 
00141     std::ostream& StreamInfo(std::ostream& os) const;
00142 
00143   public:  // without description
00144 
00145     G4DisplacedSolid(__void__&);
00146       // Fake default constructor for usage restricted to direct object
00147       // persistency for clients requiring preallocation of memory for
00148       // persistifiable objects.
00149 
00150     G4DisplacedSolid(const G4DisplacedSolid& rhs);
00151     G4DisplacedSolid& operator=(const G4DisplacedSolid& rhs);
00152       // Copy constructor and assignment operator.
00153 
00154     void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
00155     G4Polyhedron* CreatePolyhedron () const ;
00156     G4NURBS*      CreateNURBS      () const ;
00157     G4Polyhedron* GetPolyhedron    () const ;
00158       // For creating graphical representations (ie for visualisation).
00159 
00160   protected:
00161 
00162     G4VSolid* fPtrSolid ;
00163     G4AffineTransform* fPtrTransform ;
00164     G4AffineTransform* fDirectTransform ;
00165     mutable G4Polyhedron* fpPolyhedron;
00166 } ;
00167 
00168 #endif

Generated on Mon May 27 17:48:01 2013 for Geant4 by  doxygen 1.4.7