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);
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)
178 VUSolid::operator=(rhs);
219 double r123, r134, r142, r234;
231 else if ((r123 < -
fTol) && (r134 < -
fTol) && (r142 < -
fTol) && (r234 < -
fTol))
254 static const double delta = 0.5 *
fTol;
297 if ((r123 <= r134) && (r123 <= r142) && (r123 <= r234))
301 else if ((r134 <= r142) && (r134 <= r234))
305 else if (r142 <= r234)
328 double extraDistance = 10.0 *
fTol;
335 if ((t >= -
fTol) && (t < tmin))
338 hp = p + vu * (t + extraDistance);
353 if ((t >= -
fTol) && (t < tmin))
356 hp = p + vu * (t + extraDistance);
371 if ((t >= -
fTol) && (t < tmin))
374 hp = p + vu * (t + extraDistance);
389 if ((t >= -
fTol) && (t < tmin))
392 hp = p + vu * (t + extraDistance);
423 UVector3&
n,
bool& convex,
double )
const
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
462 << t1 <<
", " << t2 <<
", " << t3 <<
", " << t4;
465 Warning, 1, message.str().c_str());
507 double t1, t2, t3, t4;
517 return (tmin <
fTol) ? 0 : tmin;
527 int oldprc = os.precision(16);
528 os <<
"-----------------------------------------------------------\n"
529 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
530 <<
" ===================================================\n"
531 <<
" Solid type: UTet\n"
533 <<
" anchor: " <<
fAnchor <<
" \n"
534 <<
" p2: " <<
fP2 <<
" \n"
535 <<
" p3: " <<
fP3 <<
" \n"
536 <<
" p4: " <<
fP4 <<
" \n"
541 <<
"-----------------------------------------------------------\n";
542 os.precision(oldprc);
557 double lambda1, lambda2;
566 area = 0.5 * (v.
Cross(w)).Mag();
567 return (p2 + lambda1 * w + lambda2 * v);
576 double chose, aOne, aTwo, aThree, aFour;
585 if ((chose >= 0.) && (chose < aOne))
589 else if ((chose >= aOne) && (chose < aOne + aTwo))
593 else if ((chose >= aOne + aTwo) && (chose < aOne + aTwo + aThree))
606 std::vector<UVector3> vertices(4);
644 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)