Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes
G4USolid Class Reference

#include <G4USolid.hh>

Inheritance diagram for G4USolid:
G4VSolid G4UBox G4UCons G4UGenericPolycone G4UOrb G4UPolycone G4UPolyhedra G4USphere G4UTet G4UTrd G4UTubs

Public Member Functions

 G4USolid (const G4String &pName, VUSolid *shape)
 
virtual ~G4USolid ()
 
G4bool operator== (const G4USolid &s) const
 
virtual G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
 
virtual EInside Inside (const G4ThreeVector &p) const
 
virtual G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 
virtual G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 
virtual G4double DistanceToIn (const G4ThreeVector &p) const
 
virtual G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
 
virtual G4double DistanceToOut (const G4ThreeVector &p) const
 
virtual void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
virtual G4double GetCubicVolume ()
 
virtual G4double GetSurfaceArea ()
 
virtual G4GeometryType GetEntityType () const
 
virtual G4ThreeVector GetPointOnSurface () const
 
virtual G4VSolidClone () const
 
virtual std::ostream & StreamInfo (std::ostream &os) const
 
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
virtual G4VisExtent GetExtent () const
 
G4PolyhedronCreatePolyhedron () const
 
virtual G4PolyhedronGetPolyhedron () const
 
 G4USolid (__void__ &)
 
 G4USolid (const G4USolid &rhs)
 
G4USolidoperator= (const G4USolid &rhs)
 
VUSolidGetSolid () 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
 
void DumpInfo () 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)
 

Protected Member Functions

G4ThreeVectorListCreateRotatedVertices (const G4AffineTransform &pT) const
 
- 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
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 

Protected Attributes

VUSolidfShape
 
G4PolyhedronfPolyhedron
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Detailed Description

Definition at line 46 of file G4USolid.hh.

Constructor & Destructor Documentation

G4USolid::G4USolid ( const G4String pName,
VUSolid shape 
)

Definition at line 44 of file G4USolid.cc.

44  :
46 {
47 }
const XML_Char * s
const XML_Char * name
VUSolid * fShape
Definition: G4USolid.hh:182
G4Polyhedron * fPolyhedron
Definition: G4USolid.hh:183
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60
G4USolid::~G4USolid ( )
virtual

Definition at line 54 of file G4USolid.cc.

55 {
56 }
G4USolid::G4USolid ( __void__ &  a)

Definition at line 49 of file G4USolid.cc.

50  : G4VSolid(a), fShape(0), fPolyhedron(0)
51 {
52 }
VUSolid * fShape
Definition: G4USolid.hh:182
G4Polyhedron * fPolyhedron
Definition: G4USolid.hh:183
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60
G4USolid::G4USolid ( const G4USolid rhs)

Definition at line 364 of file G4USolid.cc.

References VUSolid::Clone(), and fShape.

365  : G4VSolid(rhs), fPolyhedron(rhs.fPolyhedron)
366 {
367  fShape = rhs.fShape->Clone();
368 }
VUSolid * fShape
Definition: G4USolid.hh:182
G4Polyhedron * fPolyhedron
Definition: G4USolid.hh:183
G4VSolid(const G4String &name)
Definition: G4VSolid.cc:60
virtual VUSolid * Clone() const =0

Member Function Documentation

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

Implements G4VSolid.

Definition at line 175 of file G4USolid.cc.

References G4VSolid::ClipBetweenSections(), G4VSolid::ClipCrossSection(), CreateRotatedVertices(), VUSolid::eXaxis, VUSolid::ExtentAxis(), VUSolid::eYaxis, VUSolid::eZaxis, fShape, G4VoxelLimits::GetMaxExtent(), G4VoxelLimits::GetMaxXExtent(), G4VoxelLimits::GetMaxYExtent(), G4VoxelLimits::GetMaxZExtent(), G4VoxelLimits::GetMinExtent(), G4VoxelLimits::GetMinXExtent(), G4VoxelLimits::GetMinYExtent(), G4VoxelLimits::GetMinZExtent(), Inside(), G4AffineTransform::Inverse(), G4VoxelLimits::IsLimited(), G4AffineTransform::IsRotated(), G4VSolid::kCarTolerance, kOutside, kXAxis, kYAxis, kZAxis, G4INCL::Math::max(), G4INCL::Math::min(), G4AffineTransform::NetTranslation(), G4AffineTransform::TransformPoint(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by GetExtent().

179 {
180  if (!pTransform.IsRotated())
181  {
183  G4double offset = pTransform.NetTranslation().x();
184  if (pAxis == kYAxis)
185  {
186  eAxis = VUSolid::eYaxis;
187  offset = pTransform.NetTranslation().y();
188  }
189  if (pAxis == kZAxis)
190  {
191  eAxis = VUSolid::eZaxis;
192  offset = pTransform.NetTranslation().z();
193  }
194  fShape->ExtentAxis(eAxis, pMin, pMax);
195 
196  pMin += offset;
197  pMax += offset;
198 
199  if (pVoxelLimit.IsLimited())
200  {
201  switch (pAxis)
202  {
203  case kXAxis:
204  if ((pMin > pVoxelLimit.GetMaxXExtent() + kCarTolerance) ||
205  (pMax < pVoxelLimit.GetMinXExtent() - kCarTolerance))
206  {
207  return false;
208  }
209  else
210  {
211  pMin = std::max(pMin, pVoxelLimit.GetMinXExtent());
212  pMax = std::min(pMax, pVoxelLimit.GetMaxXExtent());
213  }
214  break;
215  case kYAxis:
216  if ((pMin > pVoxelLimit.GetMaxYExtent() + kCarTolerance) ||
217  (pMax < pVoxelLimit.GetMinYExtent() - kCarTolerance))
218  {
219  return false;
220  }
221  else
222  {
223  pMin = std::max(pMin, pVoxelLimit.GetMinYExtent());
224  pMax = std::min(pMax, pVoxelLimit.GetMaxYExtent());
225  }
226  break;
227  case kZAxis:
228  if ((pMin > pVoxelLimit.GetMaxZExtent() + kCarTolerance) ||
229  (pMax < pVoxelLimit.GetMinZExtent() - kCarTolerance))
230  {
231  return false;
232  }
233  else
234  {
235  pMin = std::max(pMin, pVoxelLimit.GetMinZExtent());
236  pMax = std::min(pMax, pVoxelLimit.GetMaxZExtent());
237  }
238  break;
239  default:
240  break;
241  }
242  pMin -= kCarTolerance ;
243  pMax += kCarTolerance ;
244  }
245  return true;
246  }
247  else // General rotated case - create and clip mesh to boundaries
248  {
249  // Rotate BoundingBox and Calculate Extent as for BREPS
250 
251  G4bool existsAfterClip = false ;
252  G4ThreeVectorList* vertices ;
253 
254  pMin = +kInfinity ;
255  pMax = -kInfinity ;
256 
257  // Calculate rotated vertex coordinates
258 
259  vertices = CreateRotatedVertices(pTransform) ;
260  ClipCrossSection(vertices, 0, pVoxelLimit, pAxis, pMin, pMax) ;
261  ClipCrossSection(vertices, 4, pVoxelLimit, pAxis, pMin, pMax) ;
262  ClipBetweenSections(vertices, 0, pVoxelLimit, pAxis, pMin, pMax) ;
263 
264  if (pVoxelLimit.IsLimited(pAxis) == false)
265  {
266  if ((pMin != kInfinity) || (pMax != -kInfinity))
267  {
268  existsAfterClip = true ;
269 
270  // Add 2*tolerance to avoid precision troubles
271 
272  pMin -= kCarTolerance;
273  pMax += kCarTolerance;
274  }
275  }
276  else
277  {
278  G4ThreeVector clipCentre(
279  (pVoxelLimit.GetMinXExtent() + pVoxelLimit.GetMaxXExtent()) * 0.5,
280  (pVoxelLimit.GetMinYExtent() + pVoxelLimit.GetMaxYExtent()) * 0.5,
281  (pVoxelLimit.GetMinZExtent() + pVoxelLimit.GetMaxZExtent()) * 0.5);
282 
283  if ((pMin != kInfinity) || (pMax != -kInfinity))
284  {
285  existsAfterClip = true ;
286 
287 
288  // Check to see if endpoints are in the solid
289 
290  clipCentre(pAxis) = pVoxelLimit.GetMinExtent(pAxis);
291 
292  if (Inside(pTransform.Inverse().TransformPoint(clipCentre)) != kOutside)
293  {
294  pMin = pVoxelLimit.GetMinExtent(pAxis);
295  }
296  else
297  {
298  pMin -= kCarTolerance;
299  }
300  clipCentre(pAxis) = pVoxelLimit.GetMaxExtent(pAxis);
301 
302  if (Inside(pTransform.Inverse().TransformPoint(clipCentre)) != kOutside)
303  {
304  pMax = pVoxelLimit.GetMaxExtent(pAxis);
305  }
306  else
307  {
308  pMax += kCarTolerance;
309  }
310  }
311 
312  // Check for case where completely enveloping clipping volume
313  // If point inside then we are confident that the solid completely
314  // envelopes the clipping volume. Hence set min/max extents according
315  // to clipping volume extents along the specified axis.
316 
317  else if (Inside(pTransform.Inverse().TransformPoint(clipCentre))
318  != kOutside)
319  {
320  existsAfterClip = true ;
321  pMin = pVoxelLimit.GetMinExtent(pAxis) ;
322  pMax = pVoxelLimit.GetMaxExtent(pAxis) ;
323  }
324  }
325  delete vertices;
326  return existsAfterClip;
327  }
328 }
void ClipCrossSection(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
Definition: G4VSolid.cc:347
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pT) const
Definition: G4USolid.cc:401
G4double GetMinYExtent() const
double x() const
G4AffineTransform Inverse() const
G4bool IsRotated() const
G4ThreeVector NetTranslation() const
virtual EInside Inside(const G4ThreeVector &p) const
Definition: G4USolid.cc:63
double z() const
G4double GetMaxXExtent() const
G4double GetMinZExtent() const
G4bool IsLimited() const
VUSolid * fShape
Definition: G4USolid.hh:182
bool G4bool
Definition: G4Types.hh:79
std::vector< G4ThreeVector > G4ThreeVectorList
Definition: G4VSolid.hh:79
EAxisType
Definition: VUSolid.hh:27
G4double GetMinXExtent() const
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
G4double GetMaxZExtent() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual void ExtentAxis(EAxisType aAxis, double &aMin, double &aMax) const
Definition: VUSolid.cc:318
double y() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double GetMaxYExtent() const
G4double kCarTolerance
Definition: G4VSolid.hh:305
double G4double
Definition: G4Types.hh:76
G4double GetMaxExtent(const EAxis pAxis) const
void ClipBetweenSections(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
Definition: G4VSolid.cc:378
G4double GetMinExtent(const EAxis pAxis) const
G4VSolid * G4USolid::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Reimplemented in G4UPolyhedra, G4UPolycone, G4UTubs, G4UCons, G4USphere, G4UTrd, G4UBox, and G4UOrb.

Definition at line 390 of file G4USolid.cc.

References G4endl, G4Exception(), GetEntityType(), and JustWarning.

391 {
392  std::ostringstream message;
393  message << "Clone() method not implemented for type: "
394  << GetEntityType() << "!" << G4endl
395  << "Returning NULL pointer!";
396  G4Exception("G4USolid::Clone()", "GeomSolids1001", JustWarning, message);
397  return 0;
398 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
virtual G4GeometryType GetEntityType() const
Definition: G4USolid.cc:346
void G4USolid::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtual

Reimplemented from G4VSolid.

Reimplemented in G4UPolyhedra, G4UPolycone, G4UTubs, G4UCons, G4USphere, G4UTrd, G4UBox, and G4UOrb.

Definition at line 330 of file G4USolid.cc.

References FatalException, G4endl, and G4Exception().

333 {
334  std::ostringstream message;
335  message << "Illegal call to G4USolid::ComputeDimensions()" << G4endl
336  << "Method not overloaded by derived class !";
337  G4Exception("G4USolid::ComputeDimensions()", "GeomSolids0003",
338  FatalException, message);
339 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
G4Polyhedron * G4USolid::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 441 of file G4USolid.cc.

References HepPolyhedron::createPolyhedron(), fShape, VUSolid::GetEntityType(), VUSolid::GetParametersList(), and python.hepunit::pi.

Referenced by GetPolyhedron().

442 {
443  G4int index = 0;
444  if (fShape->GetEntityType() == "Box")
445  {
446  double array[3];
447  fShape->GetParametersList(index, array);
448  return new G4PolyhedronBox(array[0], array[1], array[2]);
449  }
450  if (fShape->GetEntityType() == "Tubs")
451  {
452  double array[5];
453  fShape->GetParametersList(index, array);
454  return new G4PolyhedronTubs(array[0], array[1], array[2], array[3], array[4]);
455  }
456  if (fShape->GetEntityType() == "Cons")
457  {
458  double array[7];
459  fShape->GetParametersList(index, array);
460  return new G4PolyhedronCons(array[0], array[1], array[2], array[3], array[4], array[5], array[6]);
461  }
462  if (fShape->GetEntityType() == "Orb")
463  {
464  double array[1];
465  fShape->GetParametersList(index, array);
466  return new G4PolyhedronSphere(0., array[0], 0., 2 * pi, 0., pi);
467  }
468  if (fShape->GetEntityType() == "Sphere")
469  {
470  double array[6];
471  fShape->GetParametersList(index, array);
472  return new G4PolyhedronSphere(array[0], array[1], array[2], array[3], array[4], array[5]);
473  }
474  if (fShape->GetEntityType() == "Tet")
475  {
476  double array[12];
477  fShape->GetParametersList(index, array);
478  G4Polyhedron* ph = new G4Polyhedron;
479  double xyz[4][3];
480  static int faces[4][4] = {{1, 3, 2, 0}, {1, 4, 3, 0}, {1, 2, 4, 0}, {2, 3, 4, 0}};
481  xyz[0][0] = array[0];
482  xyz[0][1] = array[1];
483  xyz[0][2] = array[2];
484  xyz[1][0] = array[3];
485  xyz[1][1] = array[4];
486  xyz[1][2] = array[5];
487  xyz[2][0] = array[6];
488  xyz[2][1] = array[7];
489  xyz[2][2] = array[8];
490  xyz[3][0] = array[9];
491  xyz[3][1] = array[10];
492  xyz[3][2] = array[11];
493 
494  ph->createPolyhedron(4, 4, xyz, faces);
495  return ph;
496  }
497  if (fShape->GetEntityType() == "Trd")
498  {
499  double array[5];
500  fShape->GetParametersList(index, array);
501  return new G4PolyhedronTrd2(array[0], array[1], array[2], array[3], array[4]);
502  }
503  if (fShape->GetEntityType() == "Trap")
504  {
505  double array[12];
506  fShape->GetParametersList(index, array);
507  double phi = (array[11] != 1.0) ? (std::atan(array[10] / array[9])) : (0.0);
508  double alpha1 = std::atan(array[4]);
509  double alpha2 = std::atan(array[8]);
510  double theta = std::acos(array[11]);
511 
512  return new G4PolyhedronTrap(array[0], theta, phi,
513  array[1], array[2], array[3], alpha1,
514  array[5], array[6], array[7], alpha2);
515  }
516 
517  /*
518  if(fShape->GetEntityType()=="TessellatedSolid"){
519 
520  G4Polyhedron *uPolyhedron=fShape->GetPolyhedron();
521  std::size_t nVertices = (*uPolyhedron).vertices.size();
522  std::size_t nFacets = (*uPolyhedron).facets.size();
523 
524  G4PolyhedronArbitrary *polyhedron =
525  new G4PolyhedronArbitrary (nVertices, nFacets);
526 
527  for (std::vector<UVector3>::const_iterator v = (*uPolyhedron).vertices.begin();
528  v!=(*uPolyhedron).vertices.end(); v++)
529  {
530  UVector3 p=(*v);
531  G4ThreeVector pt(p.x,p.y,p.z);
532 
533  polyhedron->AddVertex(pt);
534  }
535  for (std::vector<UFacet>::const_iterator f=(*uPolyhedron).facets.begin();
536  f != (*uPolyhedron).facets.end(); f++)
537  {
538  polyhedron->AddFacet((*f).f1,(*f).f2,(*f).f3,(*f).f4);
539  }
540 
541  return (G4Polyhedron*) polyhedron;
542  }
543  */
544 
545  return 0;
546 }
virtual UGeometryType GetEntityType() const =0
G4int createPolyhedron(G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])
int G4int
Definition: G4Types.hh:78
VUSolid * fShape
Definition: G4USolid.hh:182
virtual void GetParametersList(int aNumber, double *aArray) const =0
G4ThreeVectorList * G4USolid::CreateRotatedVertices ( const G4AffineTransform pT) const
protected

Definition at line 401 of file G4USolid.cc.

References VUSolid::eXaxis, VUSolid::ExtentAxis(), VUSolid::eYaxis, VUSolid::eZaxis, FatalException, fShape, G4Exception(), and G4AffineTransform::TransformPoint().

Referenced by CalculateExtent().

402 {
403  G4double xMin, xMax, yMin, yMax, zMin, zMax;
404 
405  fShape->ExtentAxis(VUSolid::eXaxis, xMin, xMax);
406  fShape->ExtentAxis(VUSolid::eYaxis, yMin, yMax);
407  fShape->ExtentAxis(VUSolid::eZaxis, zMin, zMax);
408 
409  G4ThreeVectorList* vertices;
410  vertices = new G4ThreeVectorList();
411 
412  if (vertices)
413  {
414  vertices->reserve(8);
415  G4ThreeVector vertex0(xMin, yMin, zMin);
416  G4ThreeVector vertex1(xMax, yMin, zMin);
417  G4ThreeVector vertex2(xMax, yMax, zMin);
418  G4ThreeVector vertex3(xMin, yMax, zMin);
419  G4ThreeVector vertex4(xMin, yMin, zMax);
420  G4ThreeVector vertex5(xMax, yMin, zMax);
421  G4ThreeVector vertex6(xMax, yMax, zMax);
422  G4ThreeVector vertex7(xMin, yMax, zMax);
423 
424  vertices->push_back(pTransform.TransformPoint(vertex0));
425  vertices->push_back(pTransform.TransformPoint(vertex1));
426  vertices->push_back(pTransform.TransformPoint(vertex2));
427  vertices->push_back(pTransform.TransformPoint(vertex3));
428  vertices->push_back(pTransform.TransformPoint(vertex4));
429  vertices->push_back(pTransform.TransformPoint(vertex5));
430  vertices->push_back(pTransform.TransformPoint(vertex6));
431  vertices->push_back(pTransform.TransformPoint(vertex7));
432  }
433  else
434  {
435  G4Exception("G4VUSolid::CreateRotatedVertices()", "FatalError",
436  FatalException, "Out of memory - Cannot allocate vertices!");
437  }
438  return vertices;
439 }
VUSolid * fShape
Definition: G4USolid.hh:182
std::vector< G4ThreeVector > G4ThreeVectorList
Definition: G4VSolid.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual void ExtentAxis(EAxisType aAxis, double &aMin, double &aMax) const
Definition: VUSolid.cc:318
double G4double
Definition: G4Types.hh:76
void G4USolid::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 341 of file G4USolid.cc.

References G4VGraphicsScene::AddSolid().

342 {
343  scene.AddSolid(*this);
344 }
virtual void AddSolid(const G4Box &)=0
G4double G4USolid::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const
virtual

Implements G4VSolid.

Definition at line 91 of file G4USolid.cc.

References VUSolid::DistanceToIn(), fShape, test::v, CLHEP::Hep3Vector::x(), UVector3::x, CLHEP::Hep3Vector::y(), UVector3::y, CLHEP::Hep3Vector::z(), and UVector3::z.

93 {
94  UVector3 p;
95  p.x = pt.x();
96  p.y = pt.y();
97  p.z = pt.z(); // better assign at construction
98  UVector3 v;
99  v.x = d.x();
100  v.y = d.y();
101  v.z = d.z(); // better assign at construction
102  G4double dist = fShape->DistanceToIn(p, v);
103  if (dist > kInfinity) dist = kInfinity;
104  return dist;
105 }
const char * p
Definition: xmltok.h:285
double x
Definition: UVector3.hh:136
virtual double DistanceToIn(const UVector3 &aPoint, const UVector3 &aDirection, double aPstep=UUtils::kInfinity) const =0
VUSolid * fShape
Definition: G4USolid.hh:182
double z
Definition: UVector3.hh:138
double G4double
Definition: G4Types.hh:76
double y
Definition: UVector3.hh:137
G4double G4USolid::DistanceToIn ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 107 of file G4USolid.cc.

References fShape, VUSolid::SafetyFromOutside(), CLHEP::Hep3Vector::x(), UVector3::x, CLHEP::Hep3Vector::y(), UVector3::y, CLHEP::Hep3Vector::z(), and UVector3::z.

108 {
109  UVector3 p;
110  p.x = pt.x();
111  p.y = pt.y();
112  p.z = pt.z(); // better assign at construction
113  G4double dist = fShape->SafetyFromOutside(p); // true?
114  if (dist > kInfinity) dist = kInfinity;
115  return dist;
116 }
const char * p
Definition: xmltok.h:285
double x
Definition: UVector3.hh:136
VUSolid * fShape
Definition: G4USolid.hh:182
virtual double SafetyFromOutside(const UVector3 &aPoint, bool aAccurate=false) const =0
double z
Definition: UVector3.hh:138
double G4double
Definition: G4Types.hh:76
double y
Definition: UVector3.hh:137
G4double G4USolid::DistanceToOut ( const G4ThreeVector p,
const G4ThreeVector v,
const G4bool  calcNorm = false,
G4bool validNorm = 0,
G4ThreeVector n = 0 
) const
virtual

Implements G4VSolid.

Definition at line 118 of file G4USolid.cc.

References VUSolid::DistanceToOut(), fShape, n, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), test::v, CLHEP::Hep3Vector::x(), UVector3::x, CLHEP::Hep3Vector::y(), UVector3::y, CLHEP::Hep3Vector::z(), and UVector3::z.

123 {
124  UVector3 p;
125  p.x = pt.x();
126  p.y = pt.y();
127  p.z = pt.z(); // better assign at construction
128  UVector3 v;
129  v.x = d.x();
130  v.y = d.y();
131  v.z = d.z(); // better assign at construction
132  UVector3 n;
133  bool valid;
134  G4double dist = fShape->DistanceToOut(p, v, n,valid); // should use local variable
135  if(calcNorm)
136  {
137  if(valid){ *validNorm = true;}
138  else {* validNorm =false;}
139  if(*validNorm)
140  { norm->setX(n.x);
141  norm->setY(n.y);
142  norm->setZ(n.z);
143  } // *norm = n, but only after calcNorm check
144  }
145  if (dist > kInfinity) dist = kInfinity;
146  return dist;
147 }
const char * p
Definition: xmltok.h:285
double x
Definition: UVector3.hh:136
VUSolid * fShape
Definition: G4USolid.hh:182
const G4int n
virtual double DistanceToOut(const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const =0
double z
Definition: UVector3.hh:138
double G4double
Definition: G4Types.hh:76
double y
Definition: UVector3.hh:137
G4double G4USolid::DistanceToOut ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 149 of file G4USolid.cc.

References fShape, VUSolid::SafetyFromInside(), CLHEP::Hep3Vector::x(), UVector3::x, CLHEP::Hep3Vector::y(), UVector3::y, CLHEP::Hep3Vector::z(), and UVector3::z.

150 {
151  UVector3 p;
152  p.x = pt.x();
153  p.y = pt.y();
154  p.z = pt.z(); // better assign at construction
155  return fShape->SafetyFromInside(p); // true?
156 }
const char * p
Definition: xmltok.h:285
double x
Definition: UVector3.hh:136
VUSolid * fShape
Definition: G4USolid.hh:182
virtual double SafetyFromInside(const UVector3 &aPoint, bool aAccurate=false) const =0
double z
Definition: UVector3.hh:138
double y
Definition: UVector3.hh:137
G4double G4USolid::GetCubicVolume ( )
virtual

Reimplemented from G4VSolid.

Definition at line 158 of file G4USolid.cc.

References VUSolid::Capacity(), and fShape.

159 {
160  return fShape->Capacity();
161 }
VUSolid * fShape
Definition: G4USolid.hh:182
virtual double Capacity()=0
Definition: VUSolid.cc:199
G4GeometryType G4USolid::GetEntityType ( ) const
virtual

Implements G4VSolid.

Definition at line 346 of file G4USolid.cc.

References fShape, and VUSolid::GetEntityType().

Referenced by Clone().

347 {
348 
349  G4String string = fShape->GetEntityType();
350  return "G4" + string;
351 }
virtual UGeometryType GetEntityType() const =0
VUSolid * fShape
Definition: G4USolid.hh:182
G4VisExtent G4USolid::GetExtent ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 554 of file G4USolid.cc.

References CalculateExtent(), kXAxis, kYAxis, kZAxis, G4VisExtent::SetXmax(), G4VisExtent::SetXmin(), G4VisExtent::SetYmax(), G4VisExtent::SetYmin(), G4VisExtent::SetZmax(), and G4VisExtent::SetZmin().

555 {
556  G4VisExtent extent;
557  G4VoxelLimits voxelLimits; // Defaults to "infinite" limits.
558  G4AffineTransform affineTransform;
559  G4double vmin, vmax;
560  CalculateExtent(kXAxis, voxelLimits, affineTransform, vmin, vmax);
561  extent.SetXmin(vmin);
562  extent.SetXmax(vmax);
563  CalculateExtent(kYAxis, voxelLimits, affineTransform, vmin, vmax);
564  extent.SetYmin(vmin);
565  extent.SetYmax(vmax);
566  CalculateExtent(kZAxis, voxelLimits, affineTransform, vmin, vmax);
567  extent.SetZmin(vmin);
568  extent.SetZmax(vmax);
569  return extent;
570 }
void SetXmax(G4double xmax)
Definition: G4VisExtent.hh:102
void SetYmax(G4double ymax)
Definition: G4VisExtent.hh:106
void SetZmin(G4double zmin)
Definition: G4VisExtent.hh:108
void SetZmax(G4double zmax)
Definition: G4VisExtent.hh:110
void SetXmin(G4double xmin)
Definition: G4VisExtent.hh:100
double G4double
Definition: G4Types.hh:76
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
Definition: G4USolid.cc:175
void SetYmin(G4double ymin)
Definition: G4VisExtent.hh:104
G4ThreeVector G4USolid::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 168 of file G4USolid.cc.

References fShape, VUSolid::GetPointOnSurface(), UVector3::x, UVector3::y, and UVector3::z.

169 {
170  UVector3 p;
171  p = fShape->GetPointOnSurface();
172  return G4ThreeVector(p.x, p.y, p.z);
173 }
virtual UVector3 GetPointOnSurface() const =0
CLHEP::Hep3Vector G4ThreeVector
const char * p
Definition: xmltok.h:285
double x
Definition: UVector3.hh:136
VUSolid * fShape
Definition: G4USolid.hh:182
double z
Definition: UVector3.hh:138
double y
Definition: UVector3.hh:137
G4Polyhedron * G4USolid::GetPolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 548 of file G4USolid.cc.

References CreatePolyhedron(), and fPolyhedron.

549 {
551  return fPolyhedron;
552 }
G4Polyhedron * CreatePolyhedron() const
Definition: G4USolid.cc:441
G4Polyhedron * fPolyhedron
Definition: G4USolid.hh:183
VUSolid* G4USolid::GetSolid ( ) const
inline

Definition at line 171 of file G4USolid.hh.

References fShape.

172  {
173  return fShape;
174  }
VUSolid * fShape
Definition: G4USolid.hh:182
G4double G4USolid::GetSurfaceArea ( )
virtual

Reimplemented from G4VSolid.

Definition at line 163 of file G4USolid.cc.

References fShape, and VUSolid::SurfaceArea().

164 {
165  return fShape->SurfaceArea();
166 }
virtual double SurfaceArea()=0
Definition: VUSolid.cc:255
VUSolid * fShape
Definition: G4USolid.hh:182
EInside G4USolid::Inside ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 63 of file G4USolid.cc.

References VUSolid::eInside, VUSolid::eSurface, fShape, VUSolid::Inside(), kInside, kOutside, kSurface, CLHEP::Hep3Vector::x(), UVector3::x, CLHEP::Hep3Vector::y(), UVector3::y, CLHEP::Hep3Vector::z(), and UVector3::z.

Referenced by CalculateExtent().

64 {
65  UVector3 pt;
66  VUSolid::EnumInside in_temp;
67  EInside in = kOutside;
68  pt.x = p.x();
69  pt.y = p.y();
70  pt.z = p.z(); // better assign at construction
71 
72  in_temp = fShape->Inside(pt);
73 
74  if (in_temp == VUSolid::eSurface)return kSurface;
75  if (in_temp == VUSolid::eInside)return kInside;
76 
77  return in;
78 }
double x() const
virtual EnumInside Inside(const UVector3 &aPoint) const =0
double x
Definition: UVector3.hh:136
double z() const
VUSolid * fShape
Definition: G4USolid.hh:182
EnumInside
Definition: VUSolid.hh:23
EInside
Definition: geomdefs.hh:58
double y() const
double z
Definition: UVector3.hh:138
double y
Definition: UVector3.hh:137
G4USolid & G4USolid::operator= ( const G4USolid rhs)

Definition at line 370 of file G4USolid.cc.

References VUSolid::Clone(), fShape, and G4VSolid::operator=().

Referenced by G4UOrb::operator=(), G4UTet::operator=(), G4UGenericPolycone::operator=(), G4UBox::operator=(), G4UTrd::operator=(), G4UTubs::operator=(), G4USphere::operator=(), G4UCons::operator=(), G4UPolycone::operator=(), and G4UPolyhedra::operator=().

371 {
372  // Check assignment to self
373  //
374  if (this == &rhs)
375  {
376  return *this;
377  }
378 
379  // Copy base class data
380  //
381  G4VSolid::operator=(rhs);
382 
383  // Copy data
384  //
385  fShape = rhs.fShape->Clone();
386 
387  return *this;
388 }
VUSolid * fShape
Definition: G4USolid.hh:182
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:110
virtual VUSolid * Clone() const =0
G4bool G4USolid::operator== ( const G4USolid s) const

Definition at line 58 of file G4USolid.cc.

59 {
60  return (this == &s) ? true : false;
61 }
std::ostream & G4USolid::StreamInfo ( std::ostream &  os) const
virtual

Implements G4VSolid.

Definition at line 353 of file G4USolid.cc.

References fShape, and VUSolid::GetName().

354 {
355  os << "-----------------------------------------------------------\n"
356  << " *** Dump for solid - " << fShape->GetName() << " ***\n";
357  // << " ===================================================\n"
358  // << " Solid type: " << fShape->GetEntityType() << "\n"
359  // << "-----------------------------------------------------------\n";
360 
361  return os;//fShape->StreamInfo(os);
362 }
const std::string & GetName() const
Definition: VUSolid.hh:103
VUSolid * fShape
Definition: G4USolid.hh:182
G4ThreeVector G4USolid::SurfaceNormal ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 80 of file G4USolid.cc.

References fShape, n, VUSolid::Normal(), CLHEP::Hep3Vector::x(), UVector3::x, CLHEP::Hep3Vector::y(), UVector3::y, CLHEP::Hep3Vector::z(), and UVector3::z.

81 {
82  UVector3 p;
83  p.x = pt.x();
84  p.y = pt.y();
85  p.z = pt.z();
86  UVector3 n;
87  fShape->Normal(p, n);
88  return G4ThreeVector(n.x, n.y, n.z);
89 }
CLHEP::Hep3Vector G4ThreeVector
const char * p
Definition: xmltok.h:285
virtual bool Normal(const UVector3 &aPoint, UVector3 &aNormal) const =0
double x
Definition: UVector3.hh:136
VUSolid * fShape
Definition: G4USolid.hh:182
const G4int n
double z
Definition: UVector3.hh:138
double y
Definition: UVector3.hh:137

Field Documentation

G4Polyhedron* G4USolid::fPolyhedron
mutableprotected
VUSolid* G4USolid::fShape
protected

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