85 SetVertex(1, vt0 + vt1);
86 SetVertex(2, vt0 + vt2);
87 SetVertex(3, vt0 + vt3);
104 if (leng1 <= delta || leng2 <= delta || leng3 <= delta || leng4 <= delta ||
105 diag1 <= delta || diag2 <= delta)
108 message <<
"Sides/diagonals of facet are too small." <<
G4endl
109 <<
"P0 = " << GetVertex(0) <<
G4endl
110 <<
"P1 = " << GetVertex(1) <<
G4endl
111 <<
"P2 = " << GetVertex(2) <<
G4endl
112 <<
"P3 = " << GetVertex(3) <<
G4endl
113 <<
"Side1 length (P0->P1) = " << leng1 <<
G4endl
114 <<
"Side2 length (P1->P2) = " << leng2 <<
G4endl
115 <<
"Side3 length (P2->P3) = " << leng3 <<
G4endl
116 <<
"Side4 length (P3->P0) = " << leng4 <<
G4endl
117 <<
"Diagonal1 length (P0->P2) = " << diag1 <<
G4endl
118 <<
"Diagonal2 length (P1->P3) = " << diag2;
119 G4Exception(
"G4QuadrangularFacet::G4QuadrangularFacet()",
127 G4double s2 = ((e2-e1).cross(e3-e2)).mag()*0.5;
136 if (h1 <= delta || h2 <= delta || h3 <= delta || h4 <= delta )
139 message <<
"Facet has three or more collinear vertices." <<
G4endl
140 <<
"P0 = " << GetVertex(0) <<
G4endl
141 <<
"P1 = " << GetVertex(1) <<
G4endl
142 <<
"P2 = " << GetVertex(2) <<
G4endl
143 <<
"P3 = " << GetVertex(3) <<
G4endl
144 <<
"Height in P0-P1-P2 = " << h1 <<
G4endl
145 <<
"Height in P1-P2-P3 = " << h2 <<
G4endl
146 <<
"Height in P2-P3-P4 = " << h3 <<
G4endl
147 <<
"Height in P4-P0-P1 = " << h4;
148 G4Exception(
"G4QuadrangularFacet::G4QuadrangularFacet()",
161 message <<
"Facet is not planar." <<
G4endl
162 <<
"Disrepancy = " << hmin <<
G4endl
163 <<
"P0 = " << GetVertex(0) <<
G4endl
164 <<
"P1 = " << GetVertex(1) <<
G4endl
165 <<
"P2 = " << GetVertex(2) <<
G4endl
166 <<
"P3 = " << GetVertex(3);
167 G4Exception(
"G4QuadrangularFacet::G4QuadrangularFacet()",
177 if (magnitude2 > delta*delta)
179 s = normal.
dot(e1.
cross(e3-e1)) / magnitude2;
180 t = normal.
dot(e1.
cross(e2)) / magnitude2;
185 message <<
"Facet is not convex." <<
G4endl
186 <<
"Parameters of crosspoint of diagonals: "
187 << s <<
" and " << t <<
G4endl
188 <<
"should both be within (0,1) range" <<
G4endl
189 <<
"P0 = " << GetVertex(0) <<
G4endl
190 <<
"P1 = " << GetVertex(1) <<
G4endl
191 <<
"P2 = " << GetVertex(2) <<
G4endl
192 <<
"P3 = " << GetVertex(3);
193 G4Exception(
"G4QuadrangularFacet::G4QuadrangularFacet()",
203 normal = normal.
unit();
204 fFacet1.SetSurfaceNormal(normal);
205 fFacet2.SetSurfaceNormal(normal);
208 fCircumcentre = GetVertex(0) + vtmp;
210 fRadius = std::sqrt(radiusSqr);
265 if (v1.
mag2() < v2.
mag2())
return v1;
301 for (
G4int i = 0; i <= 3; ++i)
304 if (sp > ss) ss =
sp;
320 if (!intersect) intersect =
356 return "G4QuadrangularFacet";
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
void message(RunManager *runmanager)
G4ThreeVector Distance(const G4ThreeVector &p)
static double normal(HepRandomEngine *eptr)
double dot(const Hep3Vector &) const
const G4double kCarTolerance
static const G4double dirTolerance
G4GeometryType GetEntityType() const
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool outgoing, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal)
G4ThreeVector GetSurfaceNormal() const
G4TriangularFacet fFacet1
G4ThreeVector GetPointOnFace() const
G4QuadrangularFacet(const G4ThreeVector &Pt0, const G4ThreeVector &vt1, const G4ThreeVector &vt2, const G4ThreeVector &vt3, G4FacetVertexType)
G4TriangularFacet fFacet2
G4QuadrangularFacet & operator=(const G4QuadrangularFacet &right)
Hep3Vector cross(const Hep3Vector &) const
G4ThreeVector GetVertex(G4int i) const
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool outgoing, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal)
double epsilon(double density, double temperature)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4ThreeVector GetPointOnFace() const
G4ThreeVector Distance(const G4ThreeVector &p)
G4double Extent(const G4ThreeVector axis)
G4ThreeVector GetSurfaceNormal() const