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

#include <UTet.hh>

Inheritance diagram for UTet:
VUSolid

Public Member Functions

 UTet (const std::string &name, UVector3 anchor, UVector3 p2, UVector3 p3, UVector3 p4, bool *degeneracyFlag=0)
 
virtual ~UTet ()
 
EnumInside Inside (const UVector3 &p) const
 
bool Normal (const UVector3 &aPoint, UVector3 &aNormal) const
 
double SafetyFromInside (const UVector3 &aPoint, bool aAccurate=false) const
 
double SafetyFromOutside (const UVector3 &aPoint, bool aAccurate=false) const
 
double DistanceToIn (const UVector3 &aPoint, const UVector3 &aDirection, double aPstep=UUtils::kInfinity) const
 
double DistanceToOut (const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const
 
void Extent (UVector3 &aMin, UVector3 &aMax) const
 
double Capacity ()
 
double SurfaceArea ()
 
UGeometryType GetEntityType () const
 
void ComputeBBox (UBBox *, bool)
 
void GetParametersList (int aNumber, double *aArray) const
 
VUSolidClone () const
 
UVector3 GetPointOnSurface () const
 
std::ostream & StreamInfo (std::ostream &os) const
 
 UTet (const UTet &rhs)
 
UTetoperator= (const UTet &rhs)
 
const char * CVSHeaderVers ()
 
const char * CVSFileVers ()
 
void PrintWarnings (bool flag)
 
std::vector< UVector3GetVertices () const
 
- Public Member Functions inherited from VUSolid
 VUSolid ()
 
 VUSolid (const std::string &name)
 
virtual ~VUSolid ()
 
double GetCarTolerance () const
 
double GetRadTolerance () const
 
double GetAngTolerance () const
 
void SetCarTolerance (double eps)
 
void SetRadTolerance (double eps)
 
void SetAngTolerance (double eps)
 
virtual void ExtentAxis (EAxisType aAxis, double &aMin, double &aMax) const
 
const std::string & GetName () const
 
void SetName (const std::string &aName)
 
virtual void SamplePointsInside (int, UVector3 *) const
 
virtual void SamplePointsOnSurface (int, UVector3 *) const
 
virtual void SamplePointsOnEdge (int, UVector3 *) const
 
double EstimateCubicVolume (int nStat, double epsilon) const
 
double EstimateSurfaceArea (int nStat, double ell) const
 

Static Public Member Functions

static bool CheckDegeneracy (UVector3 &anchor, UVector3 &p2, UVector3 &p3, UVector3 &p4)
 
- Static Public Member Functions inherited from VUSolid
static double Tolerance ()
 

Additional Inherited Members

- Public Types inherited from VUSolid
enum  EnumInside { eInside =0, eSurface =1, eOutside =2 }
 
enum  EAxisType { eXaxis =0, eYaxis =1, eZaxis =2 }
 
- Static Protected Attributes inherited from VUSolid
static double fgTolerance = 1.0E-9
 
static double frTolerance = 1.0E-9
 
static double faTolerance = 1.0E-9
 

Detailed Description

Definition at line 27 of file UTet.hh.

Constructor & Destructor Documentation

UTet::UTet ( const std::string &  name,
UVector3  anchor,
UVector3  p2,
UVector3  p3,
UVector3  p4,
bool *  degeneracyFlag = 0 
)

Definition at line 35 of file UTet.cc.

References UVector3::Cross(), UVector3::Dot(), UUtils::Exception(), FatalErrorInArguments, UVector3::Mag(), G4INCL::Math::max(), G4INCL::Math::min(), UVector3::Unit(), UVector3::x, UVector3::y, and UVector3::z.

Referenced by Clone().

40  : VUSolid(name), warningFlag(0)
41 {
42  // fV<x><y> is vector from vertex <y> to vertex <x>
43  //
44  UVector3 fV21 = p2 - anchor;
45  UVector3 fV31 = p3 - anchor;
46  UVector3 fV41 = p4 - anchor;
47 
48  // make sure this is a correctly oriented set of points for the tetrahedron
49  //
50  double signed_vol = fV21.Cross(fV31).Dot(fV41);
51  if (signed_vol < 0.0)
52  {
53  UVector3 temp(p4);
54  p4 = p3;
55  p3 = temp;
56  temp = fV41;
57  fV41 = fV31;
58  fV31 = temp;
59  }
60  fCubicVolume = std::fabs(signed_vol) / 6.;
61 
62  //UVector3 fV24=p2-p4;
63  UVector3 fV43 = p4 - p3;
64  UVector3 fV32 = p3 - p2;
65 
66  fXMin = std::min(std::min(std::min(anchor.x, p2.x), p3.x), p4.x);
67  fXMax = std::max(std::max(std::max(anchor.x, p2.x), p3.x), p4.x);
68  fYMin = std::min(std::min(std::min(anchor.y, p2.y), p3.y), p4.y);
69  fYMax = std::max(std::max(std::max(anchor.y, p2.y), p3.y), p4.y);
70  fZMin = std::min(std::min(std::min(anchor.z, p2.z), p3.z), p4.z);
71  fZMax = std::max(std::max(std::max(anchor.z, p2.z), p3.z), p4.z);
72 
73  fDx = (fXMax - fXMin) * 0.5;
74  fDy = (fYMax - fYMin) * 0.5;
75  fDz = (fZMax - fZMin) * 0.5;
76 
77  fMiddle = UVector3(fXMax + fXMin, fYMax + fYMin, fZMax + fZMin) * 0.5;
78  fMaxSize = std::max(std::max(std::max((anchor - fMiddle).Mag(),
79  (p2 - fMiddle).Mag()),
80  (p3 - fMiddle).Mag()),
81  (p4 - fMiddle).Mag());
82 
83  bool degenerate = std::fabs(signed_vol) < 1e-9 * fMaxSize * fMaxSize * fMaxSize;
84 
85  if (degeneracyFlag) *degeneracyFlag = degenerate;
86  else if (degenerate)
87  {
88  UUtils::Exception("UTet::UTet()", "GeomSolids0002", FatalErrorInArguments, 1,
89  "Degenerate tetrahedron not allowed.");
90  }
91 
92  fTol = 1e-9 * (std::fabs(fXMin) + std::fabs(fXMax) + std::fabs(fYMin)
93  + std::fabs(fYMax) + std::fabs(fZMin) + std::fabs(fZMax));
94  //fTol=kCarTolerance;
95 
96  fAnchor = anchor;
97  fP2 = p2;
98  fP3 = p3;
99  fP4 = p4;
100 
101  UVector3 fCenter123 = (anchor + p2 + p3) * (1.0 / 3.0); // face center
102  UVector3 fCenter134 = (anchor + p4 + p3) * (1.0 / 3.0);
103  UVector3 fCenter142 = (anchor + p4 + p2) * (1.0 / 3.0);
104  UVector3 fCenter234 = (p2 + p3 + p4) * (1.0 / 3.0);
105 
106  // compute area of each triangular face by cross product
107  // and sum for total surface area
108 
109  UVector3 normal123 = fV31.Cross(fV21);
110  UVector3 normal134 = fV41.Cross(fV31);
111  UVector3 normal142 = fV21.Cross(fV41);
112  UVector3 normal234 = fV32.Cross(fV43);
113 
114  fSurfaceArea = (
115  normal123.Mag() +
116  normal134.Mag() +
117  normal142.Mag() +
118  normal234.Mag()
119  ) / 2.0;
120 
121  fNormal123 = normal123.Unit();
122  fNormal134 = normal134.Unit();
123  fNormal142 = normal142.Unit();
124  fNormal234 = normal234.Unit();
125 
126  fCdotN123 = fCenter123.Dot(fNormal123);
127  fCdotN134 = fCenter134.Dot(fNormal134);
128  fCdotN142 = fCenter142.Dot(fNormal142);
129  fCdotN234 = fCenter234.Dot(fNormal234);
130 }
VUSolid()
Definition: VUSolid.cc:18
UVector3 Cross(const UVector3 &) const
Definition: UVector3.hh:262
const XML_Char * name
double x
Definition: UVector3.hh:136
double Dot(const UVector3 &) const
Definition: UVector3.hh:257
double Mag() const
Definition: UVector3.cc:48
T max(const T t1, const T t2)
brief Return the largest of the two arguments
UVector3 Unit() const
Definition: UVector3.cc:80
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
void Exception(const char *originOfException, const char *exceptionCode, ExceptionSeverity severity, int level, const char *description)
Definition: UUtils.cc:177
double z
Definition: UVector3.hh:138
double y
Definition: UVector3.hh:137
UTet::~UTet ( )
virtual

Definition at line 137 of file UTet.cc.

138 {
139  ;
140 }
UTet::UTet ( const UTet rhs)

Definition at line 146 of file UTet.cc.

147  : VUSolid(rhs),
148  fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
149  fAnchor(rhs.fAnchor),
150  fP2(rhs.fP2), fP3(rhs.fP3), fP4(rhs.fP4), fMiddle(rhs.fMiddle),
151  fNormal123(rhs.fNormal123), fNormal142(rhs.fNormal142),
152  fNormal134(rhs.fNormal134), fNormal234(rhs.fNormal234),
153  warningFlag(rhs.warningFlag), fCdotN123(rhs.fCdotN123),
154  fCdotN142(rhs.fCdotN142), fCdotN134(rhs.fCdotN134),
155  fCdotN234(rhs.fCdotN234), fXMin(rhs.fXMin), fXMax(rhs.fXMax),
156  fYMin(rhs.fYMin), fYMax(rhs.fYMax), fZMin(rhs.fZMin), fZMax(rhs.fZMax),
157  fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz), fTol(rhs.fTol),
158  fMaxSize(rhs.fMaxSize)
159 {
160 }
VUSolid()
Definition: VUSolid.cc:18

Member Function Documentation

double UTet::Capacity ( )
virtual

Implements VUSolid.

Definition at line 652 of file UTet.cc.

653 {
654  return fCubicVolume;
655 }
static bool UTet::CheckDegeneracy ( UVector3 anchor,
UVector3 p2,
UVector3 p3,
UVector3 p4 
)
static
VUSolid * UTet::Clone ( ) const
virtual

Implements VUSolid.

Definition at line 642 of file UTet.cc.

References UTet().

643 {
644  return new UTet(*this);
645 }
UTet(const std::string &name, UVector3 anchor, UVector3 p2, UVector3 p3, UVector3 p4, bool *degeneracyFlag=0)
Definition: UTet.cc:35
void UTet::ComputeBBox ( UBBox ,
bool   
)
inlinevirtual

Implements VUSolid.

Definition at line 70 of file UTet.hh.

70 {}
const char* UTet::CVSFileVers ( )
inline

Definition at line 95 of file UTet.hh.

96  {
97  return CVSVers;
98  }
const char* UTet::CVSHeaderVers ( )
inline

Definition at line 91 of file UTet.hh.

92  {
93  return "$Id: G4Tet.hh 66356 2012-12-18 09:02:32Z gcosmo $";
94  }
double UTet::DistanceToIn ( const UVector3 aPoint,
const UVector3 aDirection,
double  aPstep = UUtils::kInfinity 
) const
virtual

Implements VUSolid.

Definition at line 322 of file UTet.cc.

References UVector3::Dot(), G4INCL::Math::max(), and UVector3::Unit().

324 {
325  UVector3 vu(v.Unit()), hp;
326  double vdotn, t, tmin = UUtils::kInfinity;
327 
328  double extraDistance = 10.0 * fTol; // a little ways into the solid
329 
330  vdotn = -vu.Dot(fNormal123);
331  if (vdotn > 1e-12)
332  {
333  // this is a candidate face, since it is pointing at us
334  t = (p.Dot(fNormal123) - fCdotN123) / vdotn; // # distance to intersection
335  if ((t >= -fTol) && (t < tmin))
336  {
337  // if not true, we're going away from this face or it's not close
338  hp = p + vu * (t + extraDistance); // a little beyond point of intersection
339  if ((hp.Dot(fNormal134) - fCdotN134 < 0.0) &&
340  (hp.Dot(fNormal142) - fCdotN142 < 0.0) &&
341  (hp.Dot(fNormal234) - fCdotN234 < 0.0))
342  {
343  tmin = t;
344  }
345  }
346  }
347 
348  vdotn = -vu.Dot(fNormal134);
349  if (vdotn > 1e-12)
350  {
351  // # this is a candidate face, since it is pointing at us
352  t = (p.Dot(fNormal134) - fCdotN134) / vdotn; // # distance to intersection
353  if ((t >= -fTol) && (t < tmin))
354  {
355  // if not true, we're going away from this face
356  hp = p + vu * (t + extraDistance); // a little beyond point of intersection
357  if ((hp.Dot(fNormal123) - fCdotN123 < 0.0) &&
358  (hp.Dot(fNormal142) - fCdotN142 < 0.0) &&
359  (hp.Dot(fNormal234) - fCdotN234 < 0.0))
360  {
361  tmin = t;
362  }
363  }
364  }
365 
366  vdotn = -vu.Dot(fNormal142);
367  if (vdotn > 1e-12)
368  {
369  // # this is a candidate face, since it is pointing at us
370  t = (p.Dot(fNormal142) - fCdotN142) / vdotn; // # distance to intersection
371  if ((t >= -fTol) && (t < tmin))
372  {
373  // if not true, we're going away from this face
374  hp = p + vu * (t + extraDistance); // a little beyond point of intersection
375  if ((hp.Dot(fNormal123) - fCdotN123 < 0.0) &&
376  (hp.Dot(fNormal134) - fCdotN134 < 0.0) &&
377  (hp.Dot(fNormal234) - fCdotN234 < 0.0))
378  {
379  tmin = t;
380  }
381  }
382  }
383 
384  vdotn = -vu.Dot(fNormal234);
385  if (vdotn > 1e-12)
386  {
387  // # this is a candidate face, since it is pointing at us
388  t = (p.Dot(fNormal234) - fCdotN234) / vdotn; // # distance to intersection
389  if ((t >= -fTol) && (t < tmin))
390  {
391  // if not true, we're going away from this face
392  hp = p + vu * (t + extraDistance); // a little beyond point of intersection
393  if ((hp.Dot(fNormal123) - fCdotN123 < 0.0) &&
394  (hp.Dot(fNormal134) - fCdotN134 < 0.0) &&
395  (hp.Dot(fNormal142) - fCdotN142 < 0.0))
396  {
397  tmin = t;
398  }
399  }
400  }
401 
402  return std::max(0.0, tmin);
403 }
const char * p
Definition: xmltok.h:285
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double UTet::DistanceToOut ( const UVector3 aPoint,
const UVector3 aDirection,
UVector3 aNormalVector,
bool &  aConvex,
double  aPstep = UUtils::kInfinity 
) const
virtual

Implements VUSolid.

Definition at line 422 of file UTet.cc.

References UVector3::Dot(), UUtils::Exception(), G4INCL::Math::max(), G4INCL::Math::min(), plottest35::t1, UVector3::Unit(), and Warning.

424 {
425  UVector3 vu(v.Unit());
426  double t1 = UUtils::kInfinity, t2 = UUtils::kInfinity, t3 = UUtils::kInfinity, t4 = UUtils::kInfinity, vdotn, tt;
427 
428  vdotn = vu.Dot(fNormal123);
429  if (vdotn > 1e-12) // #we're heading towards this face, so it is a candidate
430  {
431  t1 = (fCdotN123 - p.Dot(fNormal123)) / vdotn; // # distance to intersection
432  }
433 
434  vdotn = vu.Dot(fNormal134);
435  if (vdotn > 1e-12) // #we're heading towards this face, so it is a candidate
436  {
437  t2 = (fCdotN134 - p.Dot(fNormal134)) / vdotn; // # distance to intersection
438  }
439 
440  vdotn = vu.Dot(fNormal142);
441  if (vdotn > 1e-12) // #we're heading towards this face, so it is a candidate
442  {
443  t3 = (fCdotN142 - p.Dot(fNormal142)) / vdotn; // # distance to intersection
444  }
445 
446  vdotn = vu.Dot(fNormal234);
447  if (vdotn > 1e-12) // #we're heading towards this face, so it is a candidate
448  {
449  t4 = (fCdotN234 - p.Dot(fNormal234)) / vdotn; // # distance to intersection
450  }
451 
452  tt = std::min(std::min(std::min(t1, t2), t3), t4);
453 
454  if (warningFlag && (tt == UUtils::kInfinity || tt < -fTol))
455  {
456  // DumpInfo();
457  std::ostringstream message;
458  message << "No good intersection found or already outside!?" << std::endl
459  << "p = " << p << std::endl
460  << "v = " << v << std::endl
461  << "t1, t2, t3, t4 "
462  << t1 << ", " << t2 << ", " << t3 << ", " << t4;
463 
464  UUtils::Exception("UTet::DistanceToOut(p,v,...)", "GeomSolids1002",
465  Warning, 1, message.str().c_str());
466  if (convex)
467  {
468  convex = false; // flag normal as meaningless
469  }
470  }
471  else
472  {
473  static UVector3 normal;
474  if (tt == t1)
475  {
476  normal = fNormal123;
477  }
478  else if (tt == t2)
479  {
480  normal = fNormal134;
481  }
482  else if (tt == t3)
483  {
484  normal = fNormal142;
485  }
486  else if (tt == t4)
487  {
488  normal = fNormal234;
489  }
490  n = normal;
491  if (convex)
492  {
493  convex = true;
494  }
495  }
496 
497  return std::max(tt, 0.0); // avoid tt<0.0 by a tiny bit
498  // if we are right on a face
499 }
const char * p
Definition: xmltok.h:285
const G4int n
T max(const T t1, const T t2)
brief Return the largest of the two arguments
tuple t1
Definition: plottest35.py:33
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
void Exception(const char *originOfException, const char *exceptionCode, ExceptionSeverity severity, int level, const char *description)
Definition: UUtils.cc:177
void UTet::Extent ( UVector3 aMin,
UVector3 aMax 
) const
virtual

Implements VUSolid.

Definition at line 615 of file UTet.cc.

References UVector3::x, UVector3::y, and UVector3::z.

616 {
617  // Returns the full 3D cartesian extent of the solid.
618  aMin.x = -fDx;
619  aMax.x = fDx;
620  aMin.y = -fDy;
621  aMax.y = fDy;
622  aMin.z = -fDz;
623  aMax.z = fDz;
624 }
double x
Definition: UVector3.hh:136
double z
Definition: UVector3.hh:138
double y
Definition: UVector3.hh:137
UGeometryType UTet::GetEntityType ( ) const
virtual

Implements VUSolid.

Definition at line 647 of file UTet.cc.

648 {
649  return "Tet";
650 }
void UTet::GetParametersList ( int  aNumber,
double *  aArray 
) const
virtual

Implements VUSolid.

Definition at line 626 of file UTet.cc.

References UVector3::x, UVector3::y, and UVector3::z.

627 {
628  aArray[0] = fAnchor.x;
629  aArray[1] = fAnchor.y;
630  aArray[2] = fAnchor.z;
631  aArray[3] = fP2.x;
632  aArray[4] = fP2.y;
633  aArray[5] = fP2.z;
634  aArray[6] = fP3.x;
635  aArray[7] = fP3.y;
636  aArray[8] = fP3.z;
637  aArray[9] = fP4.x;
638  aArray[10] = fP4.y;
639  aArray[11] = fP4.z;
640 }
double x
Definition: UVector3.hh:136
double z
Definition: UVector3.hh:138
double y
Definition: UVector3.hh:137
UVector3 UTet::GetPointOnSurface ( ) const
virtual

Implements VUSolid.

Definition at line 574 of file UTet.cc.

References UUtils::Random().

575 {
576  double chose, aOne, aTwo, aThree, aFour;
577  UVector3 p1, p2, p3, p4;
578 
579  p1 = GetPointOnFace(fAnchor, fP2, fP3, aOne);
580  p2 = GetPointOnFace(fAnchor, fP4, fP3, aTwo);
581  p3 = GetPointOnFace(fAnchor, fP4, fP2, aThree);
582  p4 = GetPointOnFace(fP4, fP3, fP2, aFour);
583 
584  chose = UUtils::Random(0., aOne + aTwo + aThree + aFour);
585  if ((chose >= 0.) && (chose < aOne))
586  {
587  return p1;
588  }
589  else if ((chose >= aOne) && (chose < aOne + aTwo))
590  {
591  return p2;
592  }
593  else if ((chose >= aOne + aTwo) && (chose < aOne + aTwo + aThree))
594  {
595  return p3;
596  }
597  return p4;
598 }
double Random(double min=0.0, double max=1.0)
Definition: UUtils.cc:69
std::vector< UVector3 > UTet::GetVertices ( ) const

Definition at line 604 of file UTet.cc.

Referenced by G4UTet::GetVertices().

605 {
606  std::vector<UVector3> vertices(4);
607  vertices[0] = fAnchor;
608  vertices[1] = fP2;
609  vertices[2] = fP3;
610  vertices[3] = fP4;
611 
612  return vertices;
613 }
VUSolid::EnumInside UTet::Inside ( const UVector3 p) const
virtual

Implements VUSolid.

Definition at line 217 of file UTet.cc.

References UVector3::Dot(), VUSolid::eInside, VUSolid::eOutside, and VUSolid::eSurface.

218 {
219  double r123, r134, r142, r234;
220 
221  // this is written to allow if-statement truncation so the outside test
222  // (where most of the world is) can fail very quickly and efficiently
223 
224  if ((r123 = p.Dot(fNormal123) - fCdotN123) > fTol ||
225  (r134 = p.Dot(fNormal134) - fCdotN134) > fTol ||
226  (r142 = p.Dot(fNormal142) - fCdotN142) > fTol ||
227  (r234 = p.Dot(fNormal234) - fCdotN234) > fTol)
228  {
229  return eOutside; // at least one is out!
230  }
231  else if ((r123 < -fTol) && (r134 < -fTol) && (r142 < -fTol) && (r234 < -fTol))
232  {
233  return eInside; // all are definitively inside
234  }
235  else
236  {
237  return eSurface; // too close to tell
238  }
239 }
double Dot(const UVector3 &) const
Definition: UVector3.hh:257
bool UTet::Normal ( const UVector3 aPoint,
UVector3 aNormal 
) const
virtual

Implements VUSolid.

Definition at line 247 of file UTet.cc.

References UVector3::Dot(), and UVector3::Unit().

248 {
249  double r123 = std::fabs(p.Dot(fNormal123) - fCdotN123);
250  double r134 = std::fabs(p.Dot(fNormal134) - fCdotN134);
251  double r142 = std::fabs(p.Dot(fNormal142) - fCdotN142);
252  double r234 = std::fabs(p.Dot(fNormal234) - fCdotN234);
253 
254  static const double delta = 0.5 * fTol;
255  UVector3 sumnorm(0., 0., 0.);
256  int noSurfaces = 0;
257 
258  if (r123 <= delta)
259  {
260  noSurfaces ++;
261  sumnorm = fNormal123;
262  }
263 
264  if (r134 <= delta)
265  {
266  noSurfaces ++;
267  sumnorm += fNormal134;
268  }
269 
270  if (r142 <= delta)
271  {
272  noSurfaces ++;
273  sumnorm += fNormal142;
274  }
275  if (r234 <= delta)
276  {
277  noSurfaces ++;
278  sumnorm += fNormal234;
279  }
280 
281  if (noSurfaces > 0)
282  {
283  if (noSurfaces == 1)
284  {
285  n = sumnorm;
286  return true;
287  }
288  else
289  {
290  n = sumnorm.Unit();
291  return true;
292  }
293  }
294  else // Approximative Surface Normal
295  {
296 
297  if ((r123 <= r134) && (r123 <= r142) && (r123 <= r234))
298  {
299  n = fNormal123;
300  }
301  else if ((r134 <= r142) && (r134 <= r234))
302  {
303  n = fNormal134;
304  }
305  else if (r142 <= r234)
306  {
307  n = fNormal142;
308  }
309  n = fNormal234;
310  return false;
311  }
312 
313 
314 }
const char * p
Definition: xmltok.h:285
const G4int n
UTet & UTet::operator= ( const UTet rhs)

Definition at line 167 of file UTet.cc.

168 {
169  // Check assignment to self
170  //
171  if (this == &rhs)
172  {
173  return *this;
174  }
175 
176  // Copy base class data
177  //
178  VUSolid::operator=(rhs);
179 
180  // Copy data
181  //
182  fCubicVolume = rhs.fCubicVolume;
183  fSurfaceArea = rhs.fSurfaceArea;
184  fAnchor = rhs.fAnchor;
185  fP2 = rhs.fP2;
186  fP3 = rhs.fP3;
187  fP4 = rhs.fP4;
188  fMiddle = rhs.fMiddle;
189  fNormal123 = rhs.fNormal123;
190  fNormal142 = rhs.fNormal142;
191  fNormal134 = rhs.fNormal134;
192  fNormal234 = rhs.fNormal234;
193  warningFlag = rhs.warningFlag;
194  fCdotN123 = rhs.fCdotN123;
195  fCdotN142 = rhs.fCdotN142;
196  fCdotN134 = rhs.fCdotN134;
197  fCdotN234 = rhs.fCdotN234;
198  fXMin = rhs.fXMin;
199  fXMax = rhs.fXMax;
200  fYMin = rhs.fYMin;
201  fYMax = rhs.fYMax;
202  fZMin = rhs.fZMin;
203  fZMax = rhs.fZMax;
204  fDx = rhs.fDx;
205  fDy = rhs.fDy;
206  fDz = rhs.fDz;
207  fTol = rhs.fTol;
208  fMaxSize = rhs.fMaxSize;
209 
210  return *this;
211 }
void UTet::PrintWarnings ( bool  flag)
inline

Definition at line 99 of file UTet.hh.

100  {
101  warningFlag = flag;
102  }
double UTet::SafetyFromInside ( const UVector3 aPoint,
bool  aAccurate = false 
) const
virtual

Implements VUSolid.

Definition at line 505 of file UTet.cc.

References UVector3::Dot(), G4INCL::Math::min(), and plottest35::t1.

506 {
507  double t1, t2, t3, t4;
508  t1 = fCdotN123 - p.Dot(fNormal123); // distance to plane, positive if inside
509  t2 = fCdotN134 - p.Dot(fNormal134); // distance to plane
510  t3 = fCdotN142 - p.Dot(fNormal142); // distance to plane
511  t4 = fCdotN234 - p.Dot(fNormal234); // distance to plane
512 
513  // if any one of these is negative, we are outside,
514  // so return zero in that case
515 
516  double tmin = std::min(std::min(std::min(t1, t2), t3), t4);
517  return (tmin < fTol) ? 0 : tmin;
518 }
const char * p
Definition: xmltok.h:285
tuple t1
Definition: plottest35.py:33
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
double UTet::SafetyFromOutside ( const UVector3 aPoint,
bool  aAccurate = false 
) const
virtual

Implements VUSolid.

Definition at line 410 of file UTet.cc.

References G4INCL::Math::max().

412 {
413  double dd = (p - fMiddle).Mag() - fMaxSize - fTol;
414  return std::max(0.0, dd);
415 }
const char * p
Definition: xmltok.h:285
T max(const T t1, const T t2)
brief Return the largest of the two arguments
std::ostream & UTet::StreamInfo ( std::ostream &  os) const
virtual

Implements VUSolid.

Definition at line 525 of file UTet.cc.

References VUSolid::GetName().

526 {
527  int oldprc = os.precision(16);
528  os << "-----------------------------------------------------------\n"
529  << " *** Dump for solid - " << GetName() << " ***\n"
530  << " ===================================================\n"
531  << " Solid type: UTet\n"
532  << " Parameters: \n"
533  << " anchor: " << fAnchor << " \n"
534  << " p2: " << fP2 << " \n"
535  << " p3: " << fP3 << " \n"
536  << " p4: " << fP4 << " \n"
537  << " normal123: " << fNormal123 << " \n"
538  << " normal134: " << fNormal134 << " \n"
539  << " normal142: " << fNormal142 << " \n"
540  << " normal234: " << fNormal234 << " \n"
541  << "-----------------------------------------------------------\n";
542  os.precision(oldprc);
543 
544  return os;
545 }
const std::string & GetName() const
Definition: VUSolid.hh:103
double UTet::SurfaceArea ( )
virtual

Implements VUSolid.

Definition at line 657 of file UTet.cc.

658 {
659  return fSurfaceArea;
660 }

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