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)
107 ostringstream message;
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 )
138 ostringstream message;
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()",
160 ostringstream message;
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;
184 ostringstream message;
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);
228 fFacet1 = rhs.fFacet1;
229 fFacet2 = rhs.fFacet2;
241 fFacet1 = rhs.fFacet1;
242 fFacet2 = rhs.fFacet2;
265 if (v1.
mag2() < v2.
mag2())
return v1;
301 for (
G4int i = 0; i <= 3; ++i)
304 if (sp > ss) ss =
sp;
319 fFacet1.
Intersect(p,v,outgoing,distance,distFromSurface,normal);
320 if (!intersect) intersect =
321 fFacet2.
Intersect(p,v,outgoing,distance,distFromSurface,normal);
356 return "G4QuadrangularFacet";
void set(double x, double y, double z)
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool outgoing, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal)
static const G4double kInfinity
double dot(const Hep3Vector &) const
G4double Extent(const G4ThreeVector axis)
G4ThreeVector GetSurfaceNormal() const
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool outgoing, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal)
G4QuadrangularFacet(const G4ThreeVector &Pt0, const G4ThreeVector &vt1, const G4ThreeVector &vt2, const G4ThreeVector &vt3, G4FacetVertexType)
static double normal(HepRandomEngine *eptr)
G4ThreeVector GetVertex(G4int i) const
static const G4double dirTolerance
G4ThreeVector GetPointOnFace() const
G4QuadrangularFacet & operator=(const G4QuadrangularFacet &right)
const G4double kCarTolerance
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
Hep3Vector cross(const Hep3Vector &) const
G4ThreeVector GetPointOnFace() const
G4ThreeVector GetSurfaceNormal() const
G4ThreeVector Distance(const G4ThreeVector &p)
G4GeometryType GetEntityType() const
double epsilon(double density, double temperature)
G4ThreeVector Distance(const G4ThreeVector &p)