62 const char G4Tet::CVSVers[]=
"$Id: G4Tet.cc 106603 2017-10-16 09:17:44Z gcosmo $";
87 using namespace CLHEP;
103 :
G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0), warningFlag(0)
146 if(degeneracyFlag) *degeneracyFlag=degenerate;
150 "Degenerate tetrahedron not allowed.");
153 fTol=1
e-9*(std::fabs(
fXMin)+std::fabs(fXMax)+std::fabs(fYMin)
154 +std::fabs(fYMax)+std::fabs(fZMin)+std::fabs(fZMax));
199 :
G4VSolid(a), fCubicVolume(0.), fSurfaceArea(0.),
200 fRebuildPolyhedron(false), fpPolyhedron(0),
201 fAnchor(0,0,0), fP2(0,0,0), fP3(0,0,0), fP4(0,0,0), fMiddle(0,0,0),
202 fNormal123(0,0,0), fNormal142(0,0,0), fNormal134(0,0,0),
203 fNormal234(0,0,0), warningFlag(0),
204 fCdotN123(0.), fCdotN142(0.), fCdotN134(0.), fCdotN234(0.),
205 fXMin(0.), fXMax(0.), fYMin(0.), fYMax(0.), fZMin(0.), fZMax(0.),
206 fDx(0.), fDy(0.), fDz(0.), fTol(0.), fMaxSize(0.)
225 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
226 fRebuildPolyhedron(false), fpPolyhedron(0), fAnchor(rhs.fAnchor),
227 fP2(rhs.fP2), fP3(rhs.fP3), fP4(rhs.fP4), fMiddle(rhs.fMiddle),
228 fNormal123(rhs.fNormal123), fNormal142(rhs.fNormal142),
229 fNormal134(rhs.fNormal134), fNormal234(rhs.fNormal234),
230 warningFlag(rhs.warningFlag), fCdotN123(rhs.fCdotN123),
231 fCdotN142(rhs.fCdotN142), fCdotN134(rhs.fCdotN134),
232 fCdotN234(rhs.fCdotN234), fXMin(rhs.fXMin), fXMax(rhs.fXMax),
233 fYMin(rhs.fYMin), fYMax(rhs.fYMax), fZMin(rhs.fZMin), fZMax(rhs.fZMax),
234 fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz), fTol(rhs.fTol),
235 fMaxSize(rhs.fMaxSize)
248 if (
this == &rhs) {
return *
this; }
283 G4Tet *
object=
new G4Tet(
"temp",anchor,p2,p3,p4,&result);
310 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
313 message <<
"Bad bounding box (min >= max) for solid: "
315 <<
"\npMin = " << pMin
316 <<
"\npMax = " << pMax;
339 if (
true)
return bbox.
CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
343 return exist = (pMin < pMax) ?
true :
false;
351 anchor[0].set(vec[0].
x(),vec[0].
y(),vec[0].
z());
354 base[0].set(vec[1].
x(),vec[1].
y(),vec[1].
z());
355 base[1].set(vec[2].
x(),vec[2].
y(),vec[2].
z());
356 base[2].set(vec[3].
x(),vec[3].
y(),vec[3].
z());
358 std::vector<const G4ThreeVectorList *> polygons(2);
359 polygons[0] = &anchor;
438 if( noSurfaces == 1 )
444 return sumnorm.
unit();
450 if( (r123<=r134) && (r123<=r142) && (r123<=r234) ) {
return fNormal123; }
451 else if ( (r134<=r142) && (r134<=r234) ) {
return fNormal134; }
474 if( (t>=-
fTol) && (t<tmin) )
476 hp=p+vu*(t+extraDistance);
490 if( (t>=-
fTol) && (t<tmin) )
492 hp=p+vu*(t+extraDistance);
506 if( (t>=-
fTol) && (t<tmin) )
508 hp=p+vu*(t+extraDistance);
522 if( (t>=-
fTol) && (t<tmin) )
524 hp=p+vu*(t+extraDistance);
592 message <<
"No good intersection found or already outside!?" <<
G4endl
593 <<
"p = " << p /
mm <<
"mm" <<
G4endl
595 <<
"t1, t2, t3, t4 (mm) "
596 << t1/
mm <<
", " << t2/
mm <<
", " << t3/
mm <<
", " << t4/
mm;
597 G4Exception(
"G4Tet::DistanceToOut(p,v,...)",
"GeomSolids1002",
604 else if(calcNorm && n)
612 if(validNorm) { *validNorm=
true; }
636 return (tmin <
fTol)? 0:tmin;
654 return new G4Tet(*
this);
663 G4int oldprc = os.precision(16);
664 os <<
"-----------------------------------------------------------\n"
665 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
666 <<
" ===================================================\n"
667 <<
" Solid type: G4Tet\n"
670 <<
" p2: " <<
fP2/
mm <<
" mm \n"
671 <<
" p3: " <<
fP3/
mm <<
" mm \n"
672 <<
" p4: " <<
fP4/
mm <<
" mm \n"
677 <<
"-----------------------------------------------------------\n";
678 os.precision(oldprc);
702 area = 0.5*(v.
cross(w)).mag();
704 return (p2 + lambda1*w + lambda2*v);
713 G4double chose,aOne,aTwo,aThree,aFour;
722 if( (chose>=0.) && (chose <aOne) ) {
return p1;}
723 else if( (chose>=aOne) && (chose < aOne+aTwo) ) {
return p2;}
724 else if( (chose>=aOne+aTwo) && (chose<aOne+aTwo+aThree) ) {
return p3;}
734 std::vector<G4ThreeVector> vertices(4);
789 const G4int faces[4][4]={{1,3,2,0},{1,4,3,0},{1,2,4,0},{2,3,4,0}};
791 xyz[1][0]=
fP2.
x(); xyz[1][1]=
fP2.
y(); xyz[1][2]=
fP2.
z();
792 xyz[2][0]=
fP3.
x(); xyz[2][1]=
fP3.
y(); xyz[2][2]=
fP3.
z();
793 xyz[3][0]=
fP4.
x(); xyz[3][1]=
fP4.
y(); xyz[3][2]=
fP4.
z();
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
void set(double x, double y, double z)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4int createPolyhedron(G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])
std::ostream & StreamInfo(std::ostream &os) const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
CLHEP::Hep3Vector G4ThreeVector
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
std::vector< ExP01TrackerHit * > a
virtual void AddSolid(const G4Box &)=0
static const G4double kInfinity
static const char CVSVers[]
static G4bool CheckDegeneracy(G4ThreeVector anchor, G4ThreeVector p2, G4ThreeVector p3, G4ThreeVector p4)
G4ThreeVector GetPointOnSurface() const
static constexpr double mm
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
void message(RunManager *runmanager)
static double normal(HepRandomEngine *eptr)
double dot(const Hep3Vector &) const
G4double GetSurfaceArea()
const XML_Char int const XML_Char int const XML_Char * base
EInside Inside(const G4ThreeVector &p) const
G4double GetCubicVolume()
std::vector< G4ThreeVector > GetVertices() const
G4VSolid & operator=(const G4VSolid &rhs)
G4bool BoundingBoxVsVoxelLimits(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
G4ThreeVector GetPointOnFace(G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4double &area) const
G4Polyhedron * fpPolyhedron
std::vector< G4ThreeVector > G4ThreeVectorList
#define G4MUTEX_INITIALIZER
G4Tet & operator=(const G4Tet &rhs)
void DescribeYourselfTo(G4VGraphicsScene &scene) const
ThreeVector shoot(const G4int Ap, const G4int Af)
Hep3Vector cross(const Hep3Vector &) const
static G4int GetNumberOfRotationSteps()
G4double G4ParticleHPJENDLHEData::G4double result
G4Polyhedron * CreatePolyhedron() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4Tet(const G4String &pName, G4ThreeVector anchor, G4ThreeVector p2, G4ThreeVector p3, G4ThreeVector p4, G4bool *degeneracyFlag=0)
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
G4GeometryType GetEntityType() const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4VisExtent GetExtent() const
G4Polyhedron * GetPolyhedron() const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4bool fRebuildPolyhedron