Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ScaledSolid Class Reference

#include <G4ScaledSolid.hh>

Inheritance diagram for G4ScaledSolid:
Collaboration diagram for G4ScaledSolid:

Public Member Functions

 G4ScaledSolid (const G4String &pName, G4VSolid *pSolid, const G4Scale3D &pScale)
 
virtual ~G4ScaledSolid ()
 
EInside Inside (const G4ThreeVector &p) const
 
void Extent (G4ThreeVector &pMin, G4ThreeVector &pMax) 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
 
G4Scale3D GetScaleTransform () const
 
void SetScaleTransform (const G4Scale3D &scale)
 
G4VSolidGetUnscaledSolid () const
 
G4GeometryType GetEntityType () const
 
G4VSolidClone () const
 
std::ostream & StreamInfo (std::ostream &os) const
 
 G4ScaledSolid (__void__ &)
 
 G4ScaledSolid (const G4ScaledSolid &rhs)
 
G4ScaledSolidoperator= (const G4ScaledSolid &rhs)
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4PolyhedronCreatePolyhedron () const
 
G4PolyhedronGetPolyhedron () const
 
- Public Member Functions inherited from G4VSolid
 G4VSolid (const G4String &name)
 
virtual ~G4VSolid ()
 
G4bool operator== (const G4VSolid &s) const
 
G4String GetName () const
 
void SetName (const G4String &name)
 
G4double GetTolerance () const
 
virtual G4double GetCubicVolume ()
 
virtual G4double GetSurfaceArea ()
 
void DumpInfo () const
 
virtual G4VisExtent GetExtent () const
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
 G4VSolid (__void__ &)
 
 G4VSolid (const G4VSolid &rhs)
 
G4VSolidoperator= (const G4VSolid &rhs)
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VSolid
void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipCrossSection (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipBetweenSections (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipPolygon (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Detailed Description

Definition at line 52 of file G4ScaledSolid.hh.

Constructor & Destructor Documentation

G4ScaledSolid::G4ScaledSolid ( const G4String pName,
G4VSolid pSolid,
const G4Scale3D pScale 
)

Definition at line 51 of file G4ScaledSolid.cc.

54  : G4VSolid(pName), fPtrSolid(pSolid),
55  fRebuildPolyhedron(false), fpPolyhedron(0)
56 {
57  fScale = new G4ScaleTransform(pScale);
58 }
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:61

Here is the caller graph for this function:

G4ScaledSolid::~G4ScaledSolid ( )
virtual

Definition at line 75 of file G4ScaledSolid.cc.

76 {
77  delete fpPolyhedron; fpPolyhedron= 0;
78  delete fScale; fScale= 0;
79 }
G4ScaledSolid::G4ScaledSolid ( __void__ &  a)

Definition at line 65 of file G4ScaledSolid.cc.

66  : G4VSolid(a), fPtrSolid(0), fScale(0),
67  fRebuildPolyhedron(false), fpPolyhedron(0)
68 {
69 }
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:61
G4ScaledSolid::G4ScaledSolid ( const G4ScaledSolid rhs)

Definition at line 85 of file G4ScaledSolid.cc.

86  : G4VSolid (rhs), fPtrSolid(rhs.fPtrSolid),
87  fRebuildPolyhedron(false), fpPolyhedron(0)
88 {
89  fScale = new G4ScaleTransform(*(rhs.fScale));
90 }
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:61

Member Function Documentation

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

Implements G4VSolid.

Definition at line 159 of file G4ScaledSolid.cc.

164 {
165  // Find bounding box of unscaled solid
166  G4ThreeVector bmin,bmax;
167  fPtrSolid->Extent(bmin,bmax);
168 
169  // Set combined transformation
170  G4Transform3D transform3D =
171  G4Transform3D(pTransform.NetRotation().inverse(),
172  pTransform.NetTranslation())*GetScaleTransform();
173 
174  // Find extent
175  G4BoundingEnvelope bbox(bmin,bmax);
176  return bbox.CalculateExtent(pAxis,pVoxelLimit,transform3D,pMin,pMax);
177 }
G4Scale3D GetScaleTransform() const
G4ThreeVector NetTranslation() const
HepRotation inverse() const
HepGeom::Transform3D G4Transform3D
G4RotationMatrix NetRotation() const
virtual void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:626

Here is the call graph for this function:

void G4ScaledSolid::CleanTransformations ( )
G4VSolid * G4ScaledSolid::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 337 of file G4ScaledSolid.cc.

338 {
339  return new G4ScaledSolid(*this);
340 }
G4ScaledSolid(const G4String &pName, G4VSolid *pSolid, const G4Scale3D &pScale)

Here is the call graph for this function:

void G4ScaledSolid::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtual

Reimplemented from G4VSolid.

Definition at line 304 of file G4ScaledSolid.cc.

307 {
308  DumpInfo();
309  G4Exception("G4ScaledSolid::ComputeDimensions()",
310  "GeomSolids0001", FatalException,
311  "Method not applicable in this context!");
312 }
void DumpInfo() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

G4Polyhedron * G4ScaledSolid::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 403 of file G4ScaledSolid.cc.

404 {
405  G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
406  polyhedron->Transform(GetScaleTransform());
407  return polyhedron;
408 }
G4Scale3D GetScaleTransform() const
HepPolyhedron & Transform(const G4Transform3D &t)
virtual G4Polyhedron * CreatePolyhedron() const
Definition: G4VSolid.cc:660

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ScaledSolid::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 393 of file G4ScaledSolid.cc.

394 {
395  scene.AddSolid (*this);
396 }
virtual void AddSolid(const G4Box &)=0

Here is the call graph for this function:

G4double G4ScaledSolid::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const
virtual

Implements G4VSolid.

Definition at line 213 of file G4ScaledSolid.cc.

215 {
216  // Transform point and direction to unscaled shape frame
217  G4ThreeVector newPoint;
218  fScale->Transform(p, newPoint);
219 
220  // Direction is un-normalized after scale transformation
221  G4ThreeVector newDirection;
222  fScale->Transform(v, newDirection);
223  newDirection = newDirection/newDirection.mag();
224 
225  // Compute distance in unscaled system
226  G4double dist = fPtrSolid->DistanceToIn(newPoint,newDirection);
227 
228  // Return converted distance to global
229  return fScale->InverseTransformDistance(dist, newDirection);
230 }
G4double InverseTransformDistance(G4double dist, const G4ThreeVector &dir) const
void Transform(const G4ThreeVector &global, G4ThreeVector &local) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
double G4double
Definition: G4Types.hh:76
double mag() const

Here is the call graph for this function:

G4double G4ScaledSolid::DistanceToIn ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 237 of file G4ScaledSolid.cc.

238 {
239  // Transform point to unscaled shape frame
240  G4ThreeVector newPoint;
241  fScale->Transform(p, newPoint);
242 
243  // Compute unscaled safety, then scale it.
244  G4double dist = fPtrSolid->DistanceToIn(newPoint);
245  return fScale->InverseTransformDistance(dist);
246 }
G4double InverseTransformDistance(G4double dist, const G4ThreeVector &dir) const
void Transform(const G4ThreeVector &global, G4ThreeVector &local) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

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

Implements G4VSolid.

Definition at line 253 of file G4ScaledSolid.cc.

258 {
259  // Transform point and direction to unscaled shape frame
260  G4ThreeVector newPoint;
261  fScale->Transform(p, newPoint);
262 
263  // Direction is un-normalized after scale transformation
264  G4ThreeVector newDirection;
265  fScale->Transform(v, newDirection);
266  newDirection = newDirection/newDirection.mag();
267 
268  // Compute distance in unscaled system
269  G4ThreeVector solNorm;
270  G4double dist = fPtrSolid->DistanceToOut(newPoint,newDirection,
271  calcNorm,validNorm,&solNorm);
272  if(calcNorm)
273  {
275  fScale->TransformNormal(solNorm, normal);
276  *n = normal/normal.mag();
277  }
278 
279  // Return distance converted to global
280  return fScale->InverseTransformDistance(dist, newDirection);
281 }
G4double InverseTransformDistance(G4double dist, const G4ThreeVector &dir) const
void TransformNormal(const G4ThreeVector &global, G4ThreeVector &local) const
void Transform(const G4ThreeVector &global, G4ThreeVector &local) const
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
double mag() const

Here is the call graph for this function:

G4double G4ScaledSolid::DistanceToOut ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 288 of file G4ScaledSolid.cc.

289 {
290  // Transform point to unscaled shape frame
291  G4ThreeVector newPoint;
292  fScale->Transform(p, newPoint);
293 
294  // Compute unscaled safety, then scale it.
295  G4double dist = fPtrSolid->DistanceToOut(newPoint);
296  return fScale->InverseTransformDistance(dist);
297 }
G4double InverseTransformDistance(G4double dist, const G4ThreeVector &dir) const
void Transform(const G4ThreeVector &global, G4ThreeVector &local) const
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0

Here is the call graph for this function:

void G4ScaledSolid::Extent ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 130 of file G4ScaledSolid.cc.

131 {
132  G4ThreeVector bmin,bmax;
133  G4ThreeVector scale = fScale->GetScale();
134 
135  fPtrSolid->Extent(bmin,bmax);
136  pMin.set(bmin.x()*scale.x(),bmin.y()*scale.y(),bmin.z()*scale.z());
137  pMax.set(bmax.x()*scale.x(),bmax.y()*scale.y(),bmax.z()*scale.z());
138 
139  // Check correctness of the bounding box
140  //
141  if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
142  {
143  std::ostringstream message;
144  message << "Bad bounding box (min >= max) for solid: "
145  << GetName() << " !"
146  << "\npMin = " << pMin
147  << "\npMax = " << pMax;
148  G4Exception("G4ScaledSolid::Extent()", "GeomMgt0001",
149  JustWarning, message);
150  DumpInfo();
151  }
152 }
void set(double x, double y, double z)
G4String GetName() const
double x() const
const G4ThreeVector & GetScale() const
double z() const
void DumpInfo() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double y() const
virtual void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:626

Here is the call graph for this function:

G4GeometryType G4ScaledSolid::GetEntityType ( ) const
virtual

Implements G4VSolid.

Definition at line 328 of file G4ScaledSolid.cc.

329 {
330  return G4String("G4ScaledSolid");
331 }

Here is the caller graph for this function:

G4ThreeVector G4ScaledSolid::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 319 of file G4ScaledSolid.cc.

320 {
321  return fScale->InverseTransform(fPtrSolid->GetPointOnSurface());
322 }
void InverseTransform(const G4ThreeVector &local, G4ThreeVector &global) const
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:153

Here is the call graph for this function:

G4Polyhedron * G4ScaledSolid::GetPolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 414 of file G4ScaledSolid.cc.

415 {
416  if (!fpPolyhedron ||
417  fRebuildPolyhedron ||
419  fpPolyhedron->GetNumberOfRotationSteps())
420  {
421  fpPolyhedron = CreatePolyhedron();
422  fRebuildPolyhedron = false;
423  }
424  return fpPolyhedron;
425 }
G4Polyhedron * CreatePolyhedron() const
static G4int GetNumberOfRotationSteps()
G4int GetNumberOfRotationStepsAtTimeOfCreation() const

Here is the call graph for this function:

G4Scale3D G4ScaledSolid::GetScaleTransform ( ) const

Definition at line 346 of file G4ScaledSolid.cc.

347 {
348  return G4Scale3D(fScale->GetScale().x(),
349  fScale->GetScale().y(),
350  fScale->GetScale().z());
351 }
double x() const
const G4ThreeVector & GetScale() const
double z() const
HepGeom::Scale3D G4Scale3D
double y() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4VSolid * G4ScaledSolid::GetUnscaledSolid ( ) const

Definition at line 121 of file G4ScaledSolid.cc.

122 {
123  return fPtrSolid;
124 }

Here is the caller graph for this function:

EInside G4ScaledSolid::Inside ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 183 of file G4ScaledSolid.cc.

184 {
185  return fPtrSolid->Inside(fScale->Transform(p));
186 }
void Transform(const G4ThreeVector &global, G4ThreeVector &local) const
virtual EInside Inside(const G4ThreeVector &p) const =0

Here is the call graph for this function:

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

Definition at line 96 of file G4ScaledSolid.cc.

97 {
98  // Check assignment to self
99  //
100  if (this == &rhs) { return *this; }
101 
102  // Copy base class data
103  //
104  G4VSolid::operator=(rhs);
105 
106  // Copy data
107  //
108  fPtrSolid = rhs.fPtrSolid;
109  delete fScale;
110  fScale = new G4ScaleTransform(*(rhs.fScale));
111  fRebuildPolyhedron = false;
112  delete fpPolyhedron; fpPolyhedron= 0;
113 
114  return *this;
115 }
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:111

Here is the call graph for this function:

void G4ScaledSolid::SetScaleTransform ( const G4Scale3D scale)

Definition at line 357 of file G4ScaledSolid.cc.

358 {
359  if (fScale) { delete fScale; }
360  fScale = new G4ScaleTransform(scale);
361  fRebuildPolyhedron = true;
362 }
std::ostream & G4ScaledSolid::StreamInfo ( std::ostream &  os) const
virtual

Implements G4VSolid.

Definition at line 368 of file G4ScaledSolid.cc.

369 {
370  os << "-----------------------------------------------------------\n"
371  << " *** Dump for Scaled solid - " << GetName() << " ***\n"
372  << " ===================================================\n"
373  << " Solid type: " << GetEntityType() << "\n"
374  << " Parameters of constituent solid: \n"
375  << "===========================================================\n";
376  fPtrSolid->StreamInfo(os);
377  os << "===========================================================\n"
378  << " Scaling: \n"
379  << " Scale transformation : \n"
380  << " " << fScale->GetScale().x() << ", "
381  << fScale->GetScale().y() << ", "
382  << fScale->GetScale().z() << "\n"
383  << "===========================================================\n";
384 
385  return os;
386 }
G4String GetName() const
double x() const
const G4ThreeVector & GetScale() const
double z() const
virtual std::ostream & StreamInfo(std::ostream &os) const =0
double y() const
G4GeometryType GetEntityType() const

Here is the call graph for this function:

G4ThreeVector G4ScaledSolid::SurfaceNormal ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 193 of file G4ScaledSolid.cc.

194 {
195  // Transform point to unscaled shape frame
196  G4ThreeVector newPoint;
197  fScale->Transform(p, newPoint);
198 
199  // Compute normal in unscaled frame
200  G4ThreeVector newNormal = fPtrSolid->SurfaceNormal(newPoint);
202 
203  // Convert normal to scaled frame
204  fScale->InverseTransformNormal(newNormal, normal);
205  return normal/normal.mag();
206 }
void InverseTransformNormal(const G4ThreeVector &local, G4ThreeVector &global) const
void Transform(const G4ThreeVector &global, G4ThreeVector &local) const
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
double mag() const

Here is the call graph for this function:


The documentation for this class was generated from the following files: