50 double signed_vol = fV21.
Cross(fV31).
Dot(fV41);
85 if (degeneracyFlag) *degeneracyFlag = degenerate;
89 "Degenerate tetrahedron not allowed.");
101 UVector3 fCenter123 = (anchor + p2 + p3) * (1.0 / 3.0);
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);
156 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
157 fAnchor(rhs.fAnchor),
158 fP2(rhs.fP2), fP3(rhs.fP3), fP4(rhs.fP4), fMiddle(rhs.fMiddle),
159 fNormal123(rhs.fNormal123), fNormal142(rhs.fNormal142),
160 fNormal134(rhs.fNormal134), fNormal234(rhs.fNormal234),
161 warningFlag(rhs.warningFlag), fCdotN123(rhs.fCdotN123),
162 fCdotN142(rhs.fCdotN142), fCdotN134(rhs.fCdotN134),
163 fCdotN234(rhs.fCdotN234), fXMin(rhs.fXMin), fXMax(rhs.fXMax),
164 fYMin(rhs.fYMin), fYMax(rhs.fYMax), fZMin(rhs.fZMin), fZMax(rhs.fZMax),
165 fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz), fTol(rhs.fTol),
166 fMaxSize(rhs.fMaxSize)
186 VUSolid::operator=(rhs);
227 double r123, r134, r142, r234;
239 else if ((r123 < -
fTol) && (r134 < -
fTol) && (r142 < -
fTol) && (r234 < -
fTol))
263 static const double delta = 0.5 *
fTol;
306 if ((r123 <= r134) && (r123 <= r142) && (r123 <= r234))
310 else if ((r134 <= r142) && (r134 <= r234))
314 else if (r142 <= r234)
337 double extraDistance = 10.0 *
fTol;
344 if ((t >= -
fTol) && (t < tmin))
347 hp = p + vu * (t + extraDistance);
362 if ((t >= -
fTol) && (t < tmin))
365 hp = p + vu * (t + extraDistance);
380 if ((t >= -
fTol) && (t < tmin))
383 hp = p + vu * (t + extraDistance);
398 if ((t >= -
fTol) && (t < tmin))
401 hp = p + vu * (t + extraDistance);
432 UVector3&
n,
bool& convex,
double )
const
466 std::ostringstream message;
467 message <<
"No good intersection found or already outside!?" << std::endl
468 <<
"p = " << p << std::endl
469 <<
"v = " << v << std::endl
471 << t1 <<
", " << t2 <<
", " << t3 <<
", " << t4;
474 Warning, 1, message.str().c_str());
516 double t1, t2, t3, t4;
526 return (tmin <
fTol) ? 0 : tmin;
536 int oldprc = os.precision(16);
537 os <<
"-----------------------------------------------------------\n"
538 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
539 <<
" ===================================================\n"
540 <<
" Solid type: UTet\n"
542 <<
" anchor: " <<
fAnchor <<
" \n"
543 <<
" p2: " <<
fP2 <<
" \n"
544 <<
" p3: " <<
fP3 <<
" \n"
545 <<
" p4: " <<
fP4 <<
" \n"
550 <<
"-----------------------------------------------------------\n";
551 os.precision(oldprc);
566 double lambda1, lambda2;
575 area = 0.5 * (v.
Cross(w)).Mag();
576 return (p2 + lambda1 * w + lambda2 * v);
585 double chose, aOne, aTwo, aThree, aFour;
594 if ((chose >= 0.) && (chose < aOne))
598 else if ((chose >= aOne) && (chose < aOne + aTwo))
602 else if ((chose >= aOne + aTwo) && (chose < aOne + aTwo + aThree))
615 std::vector<UVector3> vertices(4);
653 return new UTet(*
this);
UVector3 GetPointOnSurface() const
const std::string & GetName() const
UVector3 Cross(const UVector3 &) const
UGeometryType GetEntityType() const
double DistanceToIn(const UVector3 &aPoint, const UVector3 &aDirection, double aPstep=UUtils::kInfinity) const
void Extent(UVector3 &aMin, UVector3 &aMax) const
static double normal(HepRandomEngine *eptr)
bool Normal(const UVector3 &aPoint, UVector3 &aNormal) const
static const double kInfinity
double SafetyFromOutside(const UVector3 &aPoint, bool aAccurate=false) const
std::ostream & StreamInfo(std::ostream &os) const
double DistanceToOut(const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const
UTet & operator=(const UTet &rhs)
double Dot(const UVector3 &) const
double SafetyFromInside(const UVector3 &aPoint, bool aAccurate=false) const
void GetParametersList(int aNumber, double *aArray) const
std::vector< UVector3 > GetVertices() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
UVector3 GetPointOnFace(UVector3 p1, UVector3 p2, UVector3 p3, double &area) const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
std::string UGeometryType
void Exception(const char *originOfException, const char *exceptionCode, ExceptionSeverity severity, int level, const char *description)
UTet(const std::string &name, UVector3 anchor, UVector3 p2, UVector3 p3, UVector3 p4, bool *degeneracyFlag=0)
EnumInside Inside(const UVector3 &p) const
double Random(double min=0.0, double max=1.0)