G4DisplacedSolid Class Reference

#include <G4DisplacedSolid.hh>

Inheritance diagram for G4DisplacedSolid:

G4VSolid

Public Member Functions

 G4DisplacedSolid (const G4String &pName, G4VSolid *pSolid, G4RotationMatrix *rotMatrix, const G4ThreeVector &transVector)
 G4DisplacedSolid (const G4String &pName, G4VSolid *pSolid, const G4Transform3D &transform)
 G4DisplacedSolid (const G4String &pName, G4VSolid *pSolid, const G4AffineTransform directTransform)
virtual ~G4DisplacedSolid ()
EInside Inside (const G4ThreeVector &p) const
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
G4double DistanceToIn (const G4ThreeVector &p) const
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
G4double DistanceToOut (const G4ThreeVector &p) const
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
void CleanTransformations ()
G4ThreeVector GetPointOnSurface () const
G4GeometryType GetEntityType () const
G4VSolidClone () const
const G4DisplacedSolidGetDisplacedSolidPtr () const
G4DisplacedSolidGetDisplacedSolidPtr ()
G4VSolidGetConstituentMovedSolid () const
G4AffineTransform GetTransform () const
void SetTransform (G4AffineTransform &)
G4AffineTransform GetDirectTransform () const
void SetDirectTransform (G4AffineTransform &)
G4RotationMatrix GetFrameRotation () const
void SetFrameRotation (const G4RotationMatrix &)
G4ThreeVector GetFrameTranslation () const
void SetFrameTranslation (const G4ThreeVector &)
G4RotationMatrix GetObjectRotation () const
void SetObjectRotation (const G4RotationMatrix &)
G4ThreeVector GetObjectTranslation () const
void SetObjectTranslation (const G4ThreeVector &)
std::ostream & StreamInfo (std::ostream &os) const
 G4DisplacedSolid (__void__ &)
 G4DisplacedSolid (const G4DisplacedSolid &rhs)
G4DisplacedSolidoperator= (const G4DisplacedSolid &rhs)
void DescribeYourselfTo (G4VGraphicsScene &scene) const
G4PolyhedronCreatePolyhedron () const
G4NURBSCreateNURBS () const
G4PolyhedronGetPolyhedron () const

Protected Attributes

G4VSolidfPtrSolid
G4AffineTransformfPtrTransform
G4AffineTransformfDirectTransform
G4PolyhedronfpPolyhedron

Detailed Description

Definition at line 53 of file G4DisplacedSolid.hh.


Constructor & Destructor Documentation

G4DisplacedSolid::G4DisplacedSolid ( const G4String pName,
G4VSolid pSolid,
G4RotationMatrix rotMatrix,
const G4ThreeVector transVector 
)

Definition at line 56 of file G4DisplacedSolid.cc.

References fDirectTransform, fPtrSolid, fPtrTransform, and G4AffineTransform::Invert().

Referenced by Clone().

00060   : G4VSolid(pName), fpPolyhedron(0)
00061 {
00062   fPtrSolid = pSolid ;
00063   fPtrTransform = new G4AffineTransform(rotMatrix,transVector) ;
00064   fPtrTransform->Invert() ;
00065   fDirectTransform = new G4AffineTransform(rotMatrix,transVector) ;
00066 }

G4DisplacedSolid::G4DisplacedSolid ( const G4String pName,
G4VSolid pSolid,
const G4Transform3D transform 
)

Definition at line 72 of file G4DisplacedSolid.cc.

References fDirectTransform, fPtrSolid, fPtrTransform, and G4AffineTransform::Invert().

00075   : G4VSolid(pName), fpPolyhedron(0)
00076 {
00077   fPtrSolid = pSolid ;
00078   fDirectTransform = new G4AffineTransform(transform.getRotation().inverse(),
00079                                            transform.getTranslation()) ;
00080 
00081   fPtrTransform    = new G4AffineTransform(transform.getRotation().inverse(),
00082                                            transform.getTranslation()) ;
00083   fPtrTransform->Invert() ;
00084 }

G4DisplacedSolid::G4DisplacedSolid ( const G4String pName,
G4VSolid pSolid,
const G4AffineTransform  directTransform 
)

Definition at line 91 of file G4DisplacedSolid.cc.

References fDirectTransform, fPtrSolid, fPtrTransform, and G4AffineTransform::Inverse().

00094   : G4VSolid(pName), fpPolyhedron(0)
00095 {
00096   fPtrSolid = pSolid ;
00097   fDirectTransform = new G4AffineTransform( directTransform );
00098   fPtrTransform    = new G4AffineTransform( directTransform.Inverse() ) ; 
00099 }

G4DisplacedSolid::~G4DisplacedSolid (  )  [virtual]

Definition at line 116 of file G4DisplacedSolid.cc.

References CleanTransformations(), and fpPolyhedron.

00117 {
00118   CleanTransformations();
00119   delete fpPolyhedron;
00120 }

G4DisplacedSolid::G4DisplacedSolid ( __void__ &   ) 

Definition at line 106 of file G4DisplacedSolid.cc.

00107   : G4VSolid(a), fPtrSolid(0), fPtrTransform(0),
00108     fDirectTransform(0), fpPolyhedron(0)
00109 {
00110 }

G4DisplacedSolid::G4DisplacedSolid ( const G4DisplacedSolid rhs  ) 

Definition at line 126 of file G4DisplacedSolid.cc.

References fDirectTransform, and fPtrTransform.

00127   : G4VSolid (rhs), fPtrSolid(rhs.fPtrSolid), fpPolyhedron(0)
00128 {
00129   fPtrTransform = new G4AffineTransform(*(rhs.fPtrTransform));
00130   fDirectTransform = new G4AffineTransform(*(rhs.fDirectTransform));
00131 }


Member Function Documentation

G4bool G4DisplacedSolid::CalculateExtent ( const EAxis  pAxis,
const G4VoxelLimits pVoxelLimit,
const G4AffineTransform pTransform,
G4double pMin,
G4double pMax 
) const [virtual]

Implements G4VSolid.

Definition at line 269 of file G4DisplacedSolid.cc.

References G4VSolid::CalculateExtent(), fDirectTransform, fPtrSolid, and G4AffineTransform::Product().

00274 {
00275   G4AffineTransform sumTransform ;
00276   sumTransform.Product(*fDirectTransform,pTransform) ;
00277   return fPtrSolid->CalculateExtent(pAxis,pVoxelLimit,sumTransform,pMin,pMax) ;
00278 }

void G4DisplacedSolid::CleanTransformations (  ) 

Definition at line 158 of file G4DisplacedSolid.cc.

References fDirectTransform, and fPtrTransform.

Referenced by ~G4DisplacedSolid().

00159 {
00160   if(fPtrTransform)
00161   {
00162     delete fPtrTransform;  fPtrTransform=0;
00163     delete fDirectTransform;  fDirectTransform=0;
00164   }
00165 }

G4VSolid * G4DisplacedSolid::Clone (  )  const [virtual]

Reimplemented from G4VSolid.

Definition at line 401 of file G4DisplacedSolid.cc.

References G4DisplacedSolid().

00402 {
00403   return new G4DisplacedSolid(*this);
00404 }

void G4DisplacedSolid::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
) [virtual]

Reimplemented from G4VSolid.

Definition at line 366 of file G4DisplacedSolid.cc.

References G4VSolid::DumpInfo(), FatalException, and G4Exception().

00369 {
00370   DumpInfo();
00371   G4Exception("G4DisplacedSolid::ComputeDimensions()",
00372               "GeomSolids0001", FatalException,
00373               "Method not applicable in this context!");
00374 }

G4NURBS * G4DisplacedSolid::CreateNURBS (  )  const [virtual]

Reimplemented from G4VSolid.

Definition at line 460 of file G4DisplacedSolid.cc.

00461 {
00462   // Take into account local transformation - see CreatePolyhedron.
00463   // return fPtrSolid->CreateNURBS() ;
00464   return 0;
00465 }

G4Polyhedron * G4DisplacedSolid::CreatePolyhedron (  )  const [virtual]

Reimplemented from G4VSolid.

Definition at line 447 of file G4DisplacedSolid.cc.

References G4VSolid::CreatePolyhedron(), fPtrSolid, GetObjectRotation(), and GetObjectTranslation().

Referenced by GetPolyhedron().

00448 {
00449   G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
00450   polyhedron
00451     ->Transform(G4Transform3D(GetObjectRotation(),GetObjectTranslation()));
00452   return polyhedron;
00453 }

void G4DisplacedSolid::DescribeYourselfTo ( G4VGraphicsScene scene  )  const [virtual]

Implements G4VSolid.

Definition at line 437 of file G4DisplacedSolid.cc.

References G4VGraphicsScene::AddSolid().

00438 {
00439   scene.AddSolid (*this);
00440 }

G4double G4DisplacedSolid::DistanceToIn ( const G4ThreeVector p  )  const [virtual]

Implements G4VSolid.

Definition at line 321 of file G4DisplacedSolid.cc.

References G4VSolid::DistanceToIn(), fPtrSolid, fPtrTransform, and G4AffineTransform::TransformPoint().

00322 {
00323   G4ThreeVector newPoint = fPtrTransform->TransformPoint(p) ;
00324   return fPtrSolid->DistanceToIn(newPoint) ;   
00325 }

G4double G4DisplacedSolid::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const [virtual]

Implements G4VSolid.

Definition at line 307 of file G4DisplacedSolid.cc.

References G4VSolid::DistanceToIn(), fPtrSolid, fPtrTransform, G4AffineTransform::TransformAxis(), and G4AffineTransform::TransformPoint().

00309 {    
00310   G4ThreeVector newPoint = fPtrTransform->TransformPoint(p) ;
00311   G4ThreeVector newDirection = fPtrTransform->TransformAxis(v) ;
00312   return fPtrSolid->DistanceToIn(newPoint,newDirection) ;   
00313 }

G4double G4DisplacedSolid::DistanceToOut ( const G4ThreeVector p  )  const [virtual]

Implements G4VSolid.

Definition at line 355 of file G4DisplacedSolid.cc.

References G4VSolid::DistanceToOut(), fPtrSolid, fPtrTransform, and G4AffineTransform::TransformPoint().

00356 {
00357   G4ThreeVector newPoint = fPtrTransform->TransformPoint(p) ;
00358   return fPtrSolid->DistanceToOut(newPoint) ;   
00359 }

G4double G4DisplacedSolid::DistanceToOut ( const G4ThreeVector p,
const G4ThreeVector v,
const G4bool  calcNorm = false,
G4bool validNorm = 0,
G4ThreeVector n = 0 
) const [virtual]

Implements G4VSolid.

Definition at line 332 of file G4DisplacedSolid.cc.

References G4VSolid::DistanceToOut(), fDirectTransform, fPtrSolid, fPtrTransform, G4AffineTransform::TransformAxis(), and G4AffineTransform::TransformPoint().

00337 {
00338   G4ThreeVector solNorm ; 
00339   G4ThreeVector newPoint = fPtrTransform->TransformPoint(p) ;
00340   G4ThreeVector newDirection = fPtrTransform->TransformAxis(v) ;
00341   G4double dist = fPtrSolid->DistanceToOut(newPoint,newDirection,
00342                                            calcNorm,validNorm,&solNorm) ;
00343   if(calcNorm)
00344   { 
00345     *n = fDirectTransform->TransformAxis(solNorm) ;
00346   }
00347   return dist ;  
00348 }

G4VSolid * G4DisplacedSolid::GetConstituentMovedSolid (  )  const

Definition at line 177 of file G4DisplacedSolid.cc.

References fPtrSolid.

Referenced by G4tgbGeometryDumper::DumpBooleanVolume().

00178 { 
00179   return fPtrSolid; 
00180 } 

G4AffineTransform G4DisplacedSolid::GetDirectTransform (  )  const

Definition at line 198 of file G4DisplacedSolid.cc.

References fDirectTransform.

00199 {
00200   G4AffineTransform aTransform= *fDirectTransform;
00201   return aTransform;
00202 }

G4DisplacedSolid * G4DisplacedSolid::GetDisplacedSolidPtr (  )  [virtual]

Reimplemented from G4VSolid.

Definition at line 172 of file G4DisplacedSolid.cc.

00173 {
00174   return this;
00175 }

const G4DisplacedSolid * G4DisplacedSolid::GetDisplacedSolidPtr (  )  const [virtual]

Reimplemented from G4VSolid.

Definition at line 167 of file G4DisplacedSolid.cc.

00168 {
00169   return this;
00170 }

G4GeometryType G4DisplacedSolid::GetEntityType (  )  const [virtual]

Implements G4VSolid.

Definition at line 392 of file G4DisplacedSolid.cc.

Referenced by StreamInfo().

00393 {
00394   return G4String("G4DisplacedSolid");
00395 }

G4RotationMatrix G4DisplacedSolid::GetFrameRotation (  )  const

Definition at line 212 of file G4DisplacedSolid.cc.

References fDirectTransform, and G4AffineTransform::NetRotation().

00213 {
00214   G4RotationMatrix InvRotation= fDirectTransform->NetRotation();
00215   return InvRotation;
00216 }

G4ThreeVector G4DisplacedSolid::GetFrameTranslation (  )  const

Definition at line 226 of file G4DisplacedSolid.cc.

References fPtrTransform, and G4AffineTransform::NetTranslation().

00227 {
00228   return fPtrTransform->NetTranslation();
00229 }

G4RotationMatrix G4DisplacedSolid::GetObjectRotation (  )  const

Definition at line 239 of file G4DisplacedSolid.cc.

References fPtrTransform, and G4AffineTransform::NetRotation().

Referenced by CreatePolyhedron().

00240 {
00241   G4RotationMatrix Rotation= fPtrTransform->NetRotation();
00242   return Rotation;
00243 }

G4ThreeVector G4DisplacedSolid::GetObjectTranslation (  )  const

Definition at line 253 of file G4DisplacedSolid.cc.

References fDirectTransform, and G4AffineTransform::NetTranslation().

Referenced by CreatePolyhedron(), and G4tgbGeometryDumper::DumpBooleanVolume().

00254 {
00255   return fDirectTransform->NetTranslation();
00256 }

G4ThreeVector G4DisplacedSolid::GetPointOnSurface (  )  const [virtual]

Reimplemented from G4VSolid.

Definition at line 382 of file G4DisplacedSolid.cc.

References fDirectTransform, fPtrSolid, G4VSolid::GetPointOnSurface(), and G4AffineTransform::TransformPoint().

00383 {
00384   G4ThreeVector p =  fPtrSolid->GetPointOnSurface();
00385   return fDirectTransform->TransformPoint(p);
00386 }

G4Polyhedron * G4DisplacedSolid::GetPolyhedron (  )  const [virtual]

Reimplemented from G4VSolid.

Definition at line 471 of file G4DisplacedSolid.cc.

References CreatePolyhedron(), fpPolyhedron, and G4Polyhedron::GetNumberOfRotationStepsAtTimeOfCreation().

00472 {
00473   if (!fpPolyhedron ||
00474       fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
00475       fpPolyhedron->GetNumberOfRotationSteps())
00476     {
00477       delete fpPolyhedron;
00478       fpPolyhedron = CreatePolyhedron();
00479     }
00480   return fpPolyhedron;
00481 }

G4AffineTransform G4DisplacedSolid::GetTransform (  )  const

Definition at line 184 of file G4DisplacedSolid.cc.

References fPtrTransform.

00185 {
00186   G4AffineTransform aTransform = *fPtrTransform;
00187   return aTransform;
00188 }

EInside G4DisplacedSolid::Inside ( const G4ThreeVector p  )  const [virtual]

Implements G4VSolid.

Definition at line 284 of file G4DisplacedSolid.cc.

References fPtrSolid, fPtrTransform, G4VSolid::Inside(), and G4AffineTransform::TransformPoint().

00285 {
00286   G4ThreeVector newPoint = fPtrTransform->TransformPoint(p) ;
00287   return fPtrSolid->Inside(newPoint) ; 
00288 }

G4DisplacedSolid & G4DisplacedSolid::operator= ( const G4DisplacedSolid rhs  ) 

Definition at line 137 of file G4DisplacedSolid.cc.

References fDirectTransform, fpPolyhedron, fPtrSolid, fPtrTransform, and G4VSolid::operator=().

00138 {
00139   // Check assignment to self
00140   //
00141   if (this == &rhs)  { return *this; }
00142 
00143   // Copy base class data
00144   //
00145   G4VSolid::operator=(rhs);
00146 
00147   // Copy data
00148   //
00149   fPtrSolid = rhs.fPtrSolid;
00150   delete fPtrTransform; delete fDirectTransform;
00151   fPtrTransform = new G4AffineTransform(*(rhs.fPtrTransform));
00152   fDirectTransform = new G4AffineTransform(*(rhs.fDirectTransform));
00153   delete fpPolyhedron; fpPolyhedron= 0;
00154 
00155   return *this;
00156 }  

void G4DisplacedSolid::SetDirectTransform ( G4AffineTransform  ) 

Definition at line 204 of file G4DisplacedSolid.cc.

References fDirectTransform, and fpPolyhedron.

00205 {
00206   fDirectTransform = &transform ;
00207   fpPolyhedron = 0;
00208 }

void G4DisplacedSolid::SetFrameRotation ( const G4RotationMatrix  ) 

Definition at line 218 of file G4DisplacedSolid.cc.

References fDirectTransform, fpPolyhedron, and G4AffineTransform::SetNetRotation().

00219 {
00220   fDirectTransform->SetNetRotation(matrix);
00221   fpPolyhedron = 0;
00222 }

void G4DisplacedSolid::SetFrameTranslation ( const G4ThreeVector  ) 

Definition at line 231 of file G4DisplacedSolid.cc.

References fpPolyhedron, fPtrTransform, and G4AffineTransform::SetNetTranslation().

00232 {
00233   fPtrTransform->SetNetTranslation(vector);
00234   fpPolyhedron = 0;
00235 }

void G4DisplacedSolid::SetObjectRotation ( const G4RotationMatrix  ) 

Definition at line 245 of file G4DisplacedSolid.cc.

References fpPolyhedron, fPtrTransform, and G4AffineTransform::SetNetRotation().

00246 {
00247   fPtrTransform->SetNetRotation(matrix);
00248   fpPolyhedron = 0;
00249 }

void G4DisplacedSolid::SetObjectTranslation ( const G4ThreeVector  ) 

Definition at line 258 of file G4DisplacedSolid.cc.

References fDirectTransform, fpPolyhedron, and G4AffineTransform::SetNetTranslation().

00259 {
00260   fDirectTransform->SetNetTranslation(vector);
00261   fpPolyhedron = 0;
00262 }

void G4DisplacedSolid::SetTransform ( G4AffineTransform  ) 

Definition at line 190 of file G4DisplacedSolid.cc.

References fpPolyhedron, and fPtrTransform.

00191 {
00192   fPtrTransform = &transform ;
00193   fpPolyhedron = 0;
00194 }

std::ostream & G4DisplacedSolid::StreamInfo ( std::ostream &  os  )  const [virtual]

Implements G4VSolid.

Definition at line 410 of file G4DisplacedSolid.cc.

References fDirectTransform, fPtrSolid, GetEntityType(), G4VSolid::GetName(), G4AffineTransform::NetRotation(), G4AffineTransform::NetTranslation(), and G4VSolid::StreamInfo().

00411 {
00412   os << "-----------------------------------------------------------\n"
00413      << "    *** Dump for Displaced solid - " << GetName() << " ***\n"
00414      << "    ===================================================\n"
00415      << " Solid type: " << GetEntityType() << "\n"
00416      << " Parameters of constituent solid: \n"
00417      << "===========================================================\n";
00418   fPtrSolid->StreamInfo(os);
00419   os << "===========================================================\n"
00420      << " Transformations: \n"
00421      << "    Direct transformation - translation : \n"
00422      << "           " << fDirectTransform->NetTranslation() << "\n"
00423      << "                          - rotation    : \n"
00424      << "           ";
00425   fDirectTransform->NetRotation().print(os);
00426   os << "\n"
00427      << "===========================================================\n";
00428 
00429   return os;
00430 }

G4ThreeVector G4DisplacedSolid::SurfaceNormal ( const G4ThreeVector p  )  const [virtual]

Implements G4VSolid.

Definition at line 295 of file G4DisplacedSolid.cc.

References fDirectTransform, fPtrSolid, fPtrTransform, G4VSolid::SurfaceNormal(), G4AffineTransform::TransformAxis(), and G4AffineTransform::TransformPoint().

00296 {
00297   G4ThreeVector newPoint = fPtrTransform->TransformPoint(p) ;
00298   G4ThreeVector normal = fPtrSolid->SurfaceNormal(newPoint) ; 
00299   return fDirectTransform->TransformAxis(normal) ;
00300 }


Field Documentation

G4AffineTransform* G4DisplacedSolid::fDirectTransform [protected]

Definition at line 164 of file G4DisplacedSolid.hh.

Referenced by CalculateExtent(), CleanTransformations(), DistanceToOut(), G4DisplacedSolid(), GetDirectTransform(), GetFrameRotation(), GetObjectTranslation(), GetPointOnSurface(), operator=(), SetDirectTransform(), SetFrameRotation(), SetObjectTranslation(), StreamInfo(), and SurfaceNormal().

G4Polyhedron* G4DisplacedSolid::fpPolyhedron [mutable, protected]

Definition at line 165 of file G4DisplacedSolid.hh.

Referenced by GetPolyhedron(), operator=(), SetDirectTransform(), SetFrameRotation(), SetFrameTranslation(), SetObjectRotation(), SetObjectTranslation(), SetTransform(), and ~G4DisplacedSolid().

G4VSolid* G4DisplacedSolid::fPtrSolid [protected]

Definition at line 162 of file G4DisplacedSolid.hh.

Referenced by CalculateExtent(), CreatePolyhedron(), DistanceToIn(), DistanceToOut(), G4DisplacedSolid(), GetConstituentMovedSolid(), GetPointOnSurface(), Inside(), operator=(), StreamInfo(), and SurfaceNormal().

G4AffineTransform* G4DisplacedSolid::fPtrTransform [protected]

Definition at line 163 of file G4DisplacedSolid.hh.

Referenced by CleanTransformations(), DistanceToIn(), DistanceToOut(), G4DisplacedSolid(), GetFrameTranslation(), GetObjectRotation(), GetTransform(), Inside(), operator=(), SetFrameTranslation(), SetObjectRotation(), SetTransform(), and SurfaceNormal().


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:46 2013 for Geant4 by  doxygen 1.4.7