34#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
56 : Base_t(pName, U3Vector(anchor.x(),anchor.y(),anchor.z()),
57 U3Vector(p1.x(), p1.y(), p1.z()),
58 U3Vector(p2.x(), p2.y(), p2.z()),
59 U3Vector(p3.x(), p3.y(), p3.z()))
62 G4bool degenerate = CheckDegeneracy(anchor, p1, p2, p3);
63 if(degeneracyFlag) *degeneracyFlag = degenerate;
67 "Degenerate tetrahedron not allowed.");
71 for (
G4int i = 0; i < 3; ++i)
73 fBmin[i] = std::min(std::min(std::min(anchor[i], p1[i]), p2[i]), p3[i]);
74 fBmax[i] = std::max(std::max(std::max(anchor[i], p1[i]), p2[i]), p3[i]);
83G4UTet::G4UTet( __void__& a )
100G4UTet::G4UTet(
const G4UTet& rhs)
112G4UTet& G4UTet::operator = (
const G4UTet& rhs)
115 if (
this == &rhs) {
return *
this; }
118 Base_t::operator=(rhs);
141 G4double vol = std::abs((p1 - p0).cross(p2 - p0).dot(p3 - p0));
145 ss[0] = ((p1 - p0).cross(p2 - p0)).mag2();
146 ss[1] = ((p2 - p0).cross(p3 - p0)).mag2();
147 ss[2] = ((p3 - p0).cross(p1 - p0)).mag2();
148 ss[3] = ((p2 - p1).cross(p3 - p1)).mag2();
152 for (
G4int i = 1; i < 4; ++i) {
if (ss[i] > ss[k]) k = i; }
155 return (vol*vol <= ss[k]*hmin*hmin);
175 return new G4UTet(*
this);
189 G4bool degenerate = CheckDegeneracy(anchor, p1, p2, p3);
190 if(degeneracyFlag) *degeneracyFlag = degenerate;
194 "Degenerate tetrahedron not allowed.");
198 *
this = G4UTet(GetName(), anchor, p1, p2, p3, °enerate);
210 std::vector<U3Vector> vec(4);
211 Base_t::GetVertices(vec[0], vec[1], vec[2], vec[3]);
218std::vector<G4ThreeVector> G4UTet::GetVertices()
const
220 std::vector<U3Vector> vec(4);
221 Base_t::GetVertices(vec[0], vec[1], vec[2], vec[3]);
222 std::vector<G4ThreeVector> vertices;
223 for (
unsigned int i=0; i<4; ++i)
226 vertices.push_back(v);
239 GetVertices(fVertex[0], fVertex[1], fVertex[2], fVertex[3]);
241 G4int iout[4] = { 0, 0, 0, 0 };
242 for (
G4int i = 0; i < 4; ++i)
244 iout[i] = (fVertex[i].
x() < pMin.
x() ||
245 fVertex[i].
y() < pMin.
y() ||
246 fVertex[i].
z() < pMin.
z() ||
247 fVertex[i].
x() > pMax.
x() ||
248 fVertex[i].
y() > pMax.
y() ||
249 fVertex[i].
z() > pMax.
z());
251 if (iout[0] + iout[1] + iout[2] + iout[3] != 0)
253 std::ostringstream message;
254 message <<
"Attempt to set bounding box that does not encapsulate solid: "
255 << GetName() <<
" !\n"
256 <<
" Specified bounding box limits:\n"
257 <<
" pmin: " << pMin <<
"\n"
258 <<
" pmax: " << pMax <<
"\n"
259 <<
" Tetrahedron vertices:\n"
260 <<
" anchor " << fVertex[0] << ((iout[0]) ?
" is outside\n" :
"\n")
261 <<
" p1 " << fVertex[1] << ((iout[1]) ?
" is outside\n" :
"\n")
262 <<
" p2 " << fVertex[2] << ((iout[2]) ?
" is outside\n" :
"\n")
263 <<
" p3 " << fVertex[3] << ((iout[3]) ?
" is outside" :
"");
264 G4Exception(
"G4UTet::SetBoundingLimits()",
"GeomSolids0002",
286G4UTet::CalculateExtent(
const EAxis pAxis,
295 BoundingLimits(bmin,bmax);
300 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
306 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
308 return exist = (pMin < pMax) ?
true :
false;
313 std::vector<G4ThreeVector> vec = GetVertices();
323 std::vector<const G4ThreeVectorList *> polygons(2);
324 polygons[0] = &anchor;
328 return exists = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
338 std::vector<U3Vector> vec(4);
339 Base_t::GetVertices(vec[0], vec[1], vec[2], vec[3]);
342 const G4int faces[4][4] = {{1,3,2,0},{1,4,3,0},{1,2,4,0},{2,3,4,0}};
343 for (
unsigned int i=0; i<4; ++i)
345 xyz[i][0] = vec[i].x();
346 xyz[i][1] = vec[i].y();
347 xyz[i][2] = vec[i].z();
const G4double kCarTolerance
std::vector< G4ThreeVector > G4ThreeVectorList
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4int createPolyhedron(G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])