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()",
153 fVertices =
new vector<G4ThreeVector>(3);
179 char *p = (
char *) &rhs;
180 copy(p, p +
sizeof(*
this), (
char *)
this);
184 fVertices =
new vector<G4ThreeVector>(3);
279 if (e >= 0.0) {t = 0.0;
fSqrDist = f;}
280 else if (-e >=
fC) {t = 1.0;
fSqrDist =
fC + 2.0*e + f;}
290 if (e >= 0.0) {t = 0.0;
fSqrDist = f;}
291 else if (-e >=
fC) {t = 1.0;
fSqrDist =
fC + 2.0*e + f;}
301 if (d >= 0.0) {q = 0.0;
fSqrDist = f;}
302 else if (-d >=
fA) {q = 1.0;
fSqrDist =
fA + 2.0*d + f;}
328 if (numer >= denom) {q = 1.0; t = 0.0;
fSqrDist =
fA + 2.0*d + f;}
339 if (tmp1 <= 0.0) {t = 1.0;
fSqrDist =
fC + 2.0*e + f;}
340 else if (e >= 0.0) {t = 0.0;
fSqrDist = f;}
355 if (numer >= denom) {t = 1.0; q = 0.0;
fSqrDist = fC + 2.0*e + f;}
366 if (tmp1 <= 0.0) {q = 1.0;
fSqrDist =
fA + 2.0*d + f;}
367 else if (d >= 0.0) {q = 0.0;
fSqrDist = f;}
386 if (numer >= denom) {q = 1.0; t = 0.0;
fSqrDist =
fA + 2.0*d + f;}
489 G4bool wrongSide = (dir > 0.0 && !outgoing) || (dir < 0.0 && outgoing);
496 if (wrongSide) dist = 0.0;
499 else if (!wrongSide) dist = dist1;
515 if (sp > ss) ss =
sp;
517 if (sp > ss) ss =
sp;
587 wrongSide = (outgoing && distFromSurface < 0.0)
588 || (!outgoing && distFromSurface > 0.0);
644 vprime, P0prime, E0prime, E1prime, loc))
652 G4double s0 = (loc[0] - pprime).mag()/vprimemag;
653 G4double s1 = (loc[1] - pprime).mag()/vprimemag;
657 if ((normDist0 < 0.0 && normDist1 < 0.0)
658 || (normDist0 > 0.0 && normDist1 > 0.0)
659 || (normDist0 == 0.0 && normDist1 == 0.0) )
668 G4double dnormDist = normDist1 - normDist0;
673 if (!outgoing) distFromSurface = -distFromSurface;
678 distance = s0 - normDist0*(s1-
s0)/dnormDist;
680 if (!outgoing) distFromSurface = -distFromSurface;
700 distance = distFromSurface / w;
713 if (ss < -sTolerance || t < -tTolerance || ( ss+t -
fDet ) > detTolerance)
728 if (!outgoing) distFromSurface = -distFromSurface;
764 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)