115 if (leng1 <= delta || leng2 <= delta || leng3 <= delta)
135 message <<
"Facet is too small or too narrow." <<
G4endl
140 <<
"Side1 length (P0->P1) = " << leng1 <<
G4endl
141 <<
"Side2 length (P1->P2) = " << leng2 <<
G4endl
142 <<
"Side3 length (P2->P0) = " << leng3;
143 G4Exception(
"G4TriangularFacet::G4TriangularFacet()",
170 fVertices =
new vector<G4ThreeVector>(3);
196 char *
p = (
char *) &rhs;
197 copy(p, p +
sizeof(*
this), (
char *)
this);
201 fVertices =
new vector<G4ThreeVector>(3);
345 if (numer >= denom) {q = 1.0; t = 0.0;
fSqrDist =
fA + 2.0*d +
f;}
356 if (tmp1 <= 0.0) {t = 1.0;
fSqrDist =
fC + 2.0*e +
f;}
357 else if (e >= 0.0) {t = 0.0;
fSqrDist =
f;}
372 if (numer >= denom) {t = 1.0; q = 0.0;
fSqrDist = fC + 2.0*e +
f;}
383 if (tmp1 <= 0.0) {q = 1.0;
fSqrDist =
fA + 2.0*d +
f;}
384 else if (d >= 0.0) {q = 0.0;
fSqrDist =
f;}
403 if (numer >= denom) {q = 1.0; t = 0.0;
fSqrDist =
fA + 2.0*d +
f;}
506 G4bool wrongSide = (dir > 0.0 && !outgoing) || (dir < 0.0 && outgoing);
513 if (wrongSide) dist = 0.0;
516 else if (!wrongSide) dist = dist1;
532 if (sp > ss) ss =
sp;
534 if (sp > ss) ss =
sp;
605 wrongSide = (outgoing && distFromSurface < 0.0)
606 || (!outgoing && distFromSurface > 0.0);
662 vprime, P0prime, E0prime, E1prime, loc))
670 G4double s0 = (loc[0] - pprime).mag()/vprimemag;
671 G4double s1 = (loc[1] - pprime).mag()/vprimemag;
675 if ((normDist0 < 0.0 && normDist1 < 0.0)
676 || (normDist0 > 0.0 && normDist1 > 0.0)
677 || (normDist0 == 0.0 && normDist1 == 0.0) )
686 G4double dnormDist = normDist1 - normDist0;
691 if (!outgoing) distFromSurface = -distFromSurface;
696 distance = s0 - normDist0*(s1-
s0)/dnormDist;
698 if (!outgoing) distFromSurface = -distFromSurface;
718 distance = distFromSurface /
w;
731 if (ss < -sTolerance || t < -tTolerance || ( ss+t -
fDet ) > detTolerance)
746 if (!outgoing) distFromSurface = -distFromSurface;
761 if (u+v > 1.) { u = 1. - u; v = 1. - v; }
780 return "G4TriangularFacet";
void set(double x, double y, double z)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
static const G4double kInfinity
static G4bool IntersectLineAndTriangle2D(const G4TwoVector &p, const G4TwoVector &v, const G4TwoVector &p0, const G4TwoVector &e0, const G4TwoVector &e1, G4TwoVector location[2])
void message(RunManager *runmanager)
static double normal(HepRandomEngine *eptr)
double dot(const Hep3Vector &) const
G4ThreeVector fSurfaceNormal
static const G4double dirTolerance
static const G4double kCarTolerance
std::vector< G4ThreeVector > * fVertices
G4double Extent(const G4ThreeVector axis)
G4ThreeVector GetSurfaceNormal() const
G4ThreeVector GetPointOnFace() const
G4ThreeVector fCircumcentre
G4TriangularFacet * GetFlippedFacet()
Hep3Vector cross(const Hep3Vector &) const
G4TriangularFacet & operator=(const G4TriangularFacet &right)
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool outgoing, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal)
G4GeometryType GetEntityType() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void SetVertex(G4int i, const G4ThreeVector &val)
G4ThreeVector Distance(const G4ThreeVector &p)
G4ThreeVector GetVertex(G4int i) const
void CopyFrom(const G4TriangularFacet &rhs)
void SetSurfaceNormal(G4ThreeVector normal)
void SetVertices(std::vector< G4ThreeVector > *v)