34#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
56 : Base_t(pName, U3Vector(anchor.x(),anchor.y(),anchor.z()),
57 U3Vector(p2.x(), p2.y(), p2.z()),
58 U3Vector(p3.x(), p3.y(), p3.z()),
59 U3Vector(p4.x(), p4.y(), p4.z()))
61 G4double fXMin=std::min(std::min(std::min(anchor.
x(), p2.
x()),p3.
x()),p4.
x());
62 G4double fXMax=std::max(std::max(std::max(anchor.
x(), p2.
x()),p3.
x()),p4.
x());
63 G4double fYMin=std::min(std::min(std::min(anchor.
y(), p2.
y()),p3.
y()),p4.
y());
64 G4double fYMax=std::max(std::max(std::max(anchor.
y(), p2.
y()),p3.
y()),p4.
y());
65 G4double fZMin=std::min(std::min(std::min(anchor.
z(), p2.
z()),p3.
z()),p4.
z());
66 G4double fZMax=std::max(std::max(std::max(anchor.
z(), p2.
z()),p3.
z()),p4.
z());
69 G4double fMaxSize=std::max(std::max(std::max((anchor-fMiddle).mag(),
82 G4bool degenerate=std::fabs(signed_vol) < 1e-9*fMaxSize*fMaxSize*fMaxSize;
84 if(degeneracyFlag) *degeneracyFlag = degenerate;
88 "Degenerate tetrahedron not allowed.");
97G4UTet::G4UTet( __void__& a )
114G4UTet::G4UTet(
const G4UTet& rhs)
124G4UTet& G4UTet::operator = (
const G4UTet& rhs)
128 if (
this == &rhs) {
return *
this; }
132 Base_t::operator=(rhs);
154 return new G4UTet(*
this);
161std::vector<G4ThreeVector> G4UTet::GetVertices()
const
163 std::vector<U3Vector> vec(4);
164 Base_t::GetVertices(vec[0], vec[1], vec[2], vec[3]);
165 std::vector<G4ThreeVector> vertices;
166 for (
unsigned int i=0; i<4; ++i)
169 vertices.push_back(v);
181 Base_t::Extent(vmin,vmax);
182 pMin.
set(vmin.x(),vmin.y(),vmin.z());
183 pMax.
set(vmax.x(),vmax.y(),vmax.z());
187 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
189 std::ostringstream message;
190 message <<
"Bad bounding box (min >= max) for solid: "
192 <<
"\npMin = " << pMin
193 <<
"\npMax = " << pMax;
194 G4Exception(
"G4UTet::BoundingLimits()",
"GeomMgt0001",
205G4UTet::CalculateExtent(
const EAxis pAxis,
214 BoundingLimits(bmin,bmax);
219 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
225 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
227 return exist = (pMin < pMax) ?
true :
false;
232 std::vector<G4ThreeVector> vec = GetVertices();
242 std::vector<const G4ThreeVectorList *> polygons(2);
243 polygons[0] = &anchor;
247 return exists = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
257 std::vector<U3Vector> vec(4);
258 Base_t::GetVertices(vec[0], vec[1], vec[2], vec[3]);
261 const G4int faces[4][4] = {{1,3,2,0},{1,4,3,0},{1,2,4,0},{2,3,4,0}};
262 for (
unsigned int i=0; i<4; ++i)
264 xyz[i][0] = vec[i].x();
265 xyz[i][1] = vec[i].y();
266 xyz[i][2] = vec[i].z();
std::vector< G4ThreeVector > G4ThreeVectorList
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
Hep3Vector cross(const Hep3Vector &) const
double dot(const Hep3Vector &) const
void set(double x, double y, double z)
G4int createPolyhedron(G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])