108 ostringstream message;
109 message <<
"Length of sides of facet are too small." <<
G4endl
113 <<
"Side lengths = fVertices[0]->fVertices[1]" << eMag1 <<
G4endl
114 <<
"Side lengths = fVertices[0]->fVertices[2]" << eMag2 <<
G4endl
115 <<
"Side lengths = fVertices[1]->fVertices[2]" << eMag3;
116 G4Exception(
"G4TriangularFacet::G4TriangularFacet()",
142 ostringstream message;
143 message <<
"Area of Facet is too small, possible flat triangle!" <<
G4endl
147 <<
"Area = " <<
fArea;
148 G4Exception(
"G4TriangularFacet::G4TriangularFacet()",
156 lambda1 = (
fC-
fB) *
fA / (8.0*fArea*fArea);
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);
296 if (e >= 0.0) {t = 0.0;
fSqrDist = f;}
297 else if (-e >=
fC) {t = 1.0;
fSqrDist =
fC + 2.0*e + f;}
307 if (e >= 0.0) {t = 0.0;
fSqrDist = f;}
308 else if (-e >=
fC) {t = 1.0;
fSqrDist =
fC + 2.0*e + f;}
318 if (d >= 0.0) {q = 0.0;
fSqrDist = f;}
319 else if (-d >=
fA) {q = 1.0;
fSqrDist =
fA + 2.0*d + f;}
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;
782 return "G4TriangularFacet";
ThreeVector shoot(const G4int Ap, const G4int Af)
G4TriangularFacet & operator=(const G4TriangularFacet &right)
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool outgoing, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal)
std::vector< G4ThreeVector > * fVertices
static const G4double kInfinity
CLHEP::Hep3Vector G4ThreeVector
static const G4double kCarTolerance
void SetVertices(std::vector< G4ThreeVector > *v)
void SetVertex(G4int i, const G4ThreeVector &val)
static double normal(HepRandomEngine *eptr)
void CopyFrom(const G4TriangularFacet &rhs)
void copy(std::vector< T > &main, const std::vector< T > &data)
G4ThreeVector fCircumcentre
G4GeometryType GetEntityType() const
static const G4double dirTolerance
void SetSurfaceNormal(G4ThreeVector normal)
G4double Extent(const G4ThreeVector axis)
static G4bool IntersectLineAndTriangle2D(const G4TwoVector &p, const G4TwoVector &v, const G4TwoVector &p0, const G4TwoVector &e0, const G4TwoVector &e1, G4TwoVector location[2])
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4TriangularFacet * GetFlippedFacet()
CLHEP::Hep2Vector G4TwoVector
G4ThreeVector GetVertex(G4int i) const
G4ThreeVector GetPointOnFace() const
static const G4double alpha
G4ThreeVector GetSurfaceNormal() const
G4ThreeVector fSurfaceNormal
G4ThreeVector Distance(const G4ThreeVector &p)