38 #if !defined(G4GEOM_USE_UTET)
59 using namespace CLHEP;
77 *degeneracyFlag = degenerate;
82 message <<
"Degenerate tetrahedron: " <<
GetName() <<
" !\n"
83 <<
" anchor: " << p0 <<
"\n"
84 <<
" p1 : " << p1 <<
"\n"
85 <<
" p2 : " << p2 <<
"\n"
86 <<
" p3 : " << p3 <<
"\n"
144 if (
this == &rhs) {
return *
this; }
185 ss[0] = ((p1 - p0).
cross(p2 - p0)).mag2();
186 ss[1] = ((p2 - p0).
cross(p3 - p0)).mag2();
187 ss[2] = ((p3 - p0).
cross(p1 - p0)).mag2();
188 ss[3] = ((p2 - p1).
cross(p3 - p1)).mag2();
192 for (
G4int i = 1; i < 4; ++i) {
if (ss[i] > ss[k]) k = i; }
195 return (vol*vol <= ss[k]*hmin*hmin);
214 norm[0] = (p2 - p0).
cross(p1 - p0);
215 norm[1] = (p3 - p0).
cross(p2 - p0);
216 norm[2] = (p1 - p0).
cross(p3 - p0);
217 norm[3] = (p2 - p1).
cross(p3 - p1);
221 for (
G4int i = 0; i < 4; ++i) { norm[i] = -norm[i]; }
232 for (
G4int i = 0; i < 4; ++i) {
fArea[i] = 0.5*norm[i].
mag(); }
235 for (
G4int i = 0; i < 3; ++i)
260 message <<
"Degenerate tetrahedron is not permitted: " <<
GetName() <<
" !\n"
261 <<
" anchor: " << p0 <<
"\n"
262 <<
" p1 : " << p1 <<
"\n"
263 <<
" p2 : " << p2 <<
"\n"
264 <<
" p3 : " << p3 <<
"\n"
267 G4Exception(
"G4Tet::G4SetVertices()",
"GeomSolids0002",
299 std::vector<G4ThreeVector> vertices(4);
300 for (
G4int i = 0; i < 4; ++i) { vertices[i] =
fVertex[i]; }
351 return exist = (pMin <
pMax) ?
true :
false;
359 anchor[0].set(vec[0].
x(),vec[0].
y(),vec[0].
z());
362 base[0].set(vec[1].
x(),vec[1].
y(),vec[1].
z());
363 base[1].set(vec[2].
x(),vec[2].
y(),vec[2].
z());
364 base[2].set(vec[3].
x(),vec[3].
y(),vec[3].
z());
366 std::vector<const G4ThreeVectorList *> polygons(2);
367 polygons[0] = &anchor;
396 for (
G4int i = 0; i < 4; ++i)
400 G4double nsurf = k[0] + k[1] + k[2] + k[3];
404 if (nsurf == 1.)
return norm;
405 else if (nsurf > 1.)
return norm.
unit();
409 G4int oldprc = message.precision(16);
410 message <<
"Point p is not on surface (!?) of solid: "
412 message <<
"Position:\n";
413 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
414 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
415 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
417 G4Exception(
"G4Tet::SurfaceNormal(p)",
"GeomSolids1002",
434 for (
G4int i = 0; i < 4; ++i)
437 if (d > dist) { dist =
d; iside = i; }
451 for (
G4int i = 0; i < 4; ++i)
480 return (dist > 0.) ? dist : 0.;
495 G4int ind[4] = {0}, nside = 0;
496 for (
G4int i = 0; i < 4; ++i)
500 ind[nside] = (tmp > 0) * i;
508 for (
G4int i = 0; i < nside; ++i)
515 if (tmp < tout) { tout =
tmp; iside =
k; }
537 return (dist > 0.) ? dist : 0.;
555 return new G4Tet(*
this);
564 G4int oldprc = os.precision(16);
565 os <<
"-----------------------------------------------------------\n"
566 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
567 <<
" ===================================================\n"
570 <<
" anchor: " <<
fVertex[0]/
mm <<
" mm\n"
574 <<
"-----------------------------------------------------------\n";
575 os.precision(oldprc);
585 constexpr
G4int iface[4][3] = { {0,1,2}, {0,2,3}, {0,3,1}, {1,2,3} };
590 for ( ; i < 4; ++i) {
if ((select -=
fArea[i]) <= 0.)
break; }
600 return (r1 + r2 > 1.) ?
601 p0 + e1*(1. -
r1) + e2*(1. - r2) : p0 + e1*r1 + e2*
r2;
654 G4int k3 = (invert) ? 2 : 3;
658 for (
G4int i = 0; i < 3; ++i)
660 xyz[0][i] = fVertex[0][i];
661 xyz[1][i] = fVertex[1][i];
662 xyz[2][i] = fVertex[
k2][i];
663 xyz[3][i] = fVertex[k3][i];
667 G4int faces[4][4] = { {1,3,2,0}, {1,4,3,0}, {1,2,4,0}, {2,3,4,0} };