59 #if !defined(G4GEOM_USE_UTET)
61 const char G4Tet::CVSVers[]=
"$Id: G4Tet.cc 76263 2013-11-08 11:41:52Z gcosmo $";
78 using namespace CLHEP;
94 :
G4VSolid(pName), fpPolyhedron(0), warningFlag(0)
104 G4double signed_vol=fV21.cross(fV31).dot(fV41);
137 if(degeneracyFlag) *degeneracyFlag=degenerate;
141 "Degenerate tetrahedron not allowed.");
144 fTol=1e-9*(std::fabs(
fXMin)+std::fabs(fXMax)+std::fabs(fYMin)
145 +std::fabs(fYMax)+std::fabs(fZMin)+std::fabs(fZMax));
190 :
G4VSolid(a), fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0),
191 fAnchor(0,0,0), fP2(0,0,0), fP3(0,0,0), fP4(0,0,0), fMiddle(0,0,0),
192 fNormal123(0,0,0), fNormal142(0,0,0), fNormal134(0,0,0),
193 fNormal234(0,0,0), warningFlag(0),
194 fCdotN123(0.), fCdotN142(0.), fCdotN134(0.), fCdotN234(0.),
195 fXMin(0.), fXMax(0.), fYMin(0.), fYMax(0.), fZMin(0.), fZMax(0.),
196 fDx(0.), fDy(0.), fDz(0.), fTol(0.), fMaxSize(0.)
215 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
216 fpPolyhedron(0), fAnchor(rhs.fAnchor),
217 fP2(rhs.fP2), fP3(rhs.fP3), fP4(rhs.fP4), fMiddle(rhs.fMiddle),
218 fNormal123(rhs.fNormal123), fNormal142(rhs.fNormal142),
219 fNormal134(rhs.fNormal134), fNormal234(rhs.fNormal234),
220 warningFlag(rhs.warningFlag), fCdotN123(rhs.fCdotN123),
221 fCdotN142(rhs.fCdotN142), fCdotN134(rhs.fCdotN134),
222 fCdotN234(rhs.fCdotN234), fXMin(rhs.fXMin), fXMax(rhs.fXMax),
223 fYMin(rhs.fYMin), fYMax(rhs.fYMax), fZMin(rhs.fZMin), fZMax(rhs.fZMax),
224 fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz), fTol(rhs.fTol),
225 fMaxSize(rhs.fMaxSize)
238 if (
this == &rhs) {
return *
this; }
271 G4Tet *
object=
new G4Tet(
"temp",anchor,p2,p3,p4,&result);
318 xMin = xoffset +
fXMin;
319 xMax = xoffset +
fXMax;
321 yMin = yoffset +
fYMin;
322 yMax = yoffset +
fYMax;
324 zMin = zoffset +
fZMin;
325 zMax = zoffset +
fZMax;
453 if( noSurfaces == 1 )
459 return sumnorm.unit();
465 if( (r123<=r134) && (r123<=r142) && (r123<=r234) ) {
return fNormal123; }
466 else if ( (r134<=r142) && (r134<=r234) ) {
return fNormal134; }
489 if( (t>=-
fTol) && (t<tmin) )
491 hp=p+vu*(t+extraDistance);
505 if( (t>=-
fTol) && (t<tmin) )
507 hp=p+vu*(t+extraDistance);
521 if( (t>=-
fTol) && (t<tmin) )
523 hp=p+vu*(t+extraDistance);
537 if( (t>=-
fTol) && (t<tmin) )
539 hp=p+vu*(t+extraDistance);
606 std::ostringstream message;
607 message <<
"No good intersection found or already outside!?" <<
G4endl
608 <<
"p = " << p /
mm <<
"mm" <<
G4endl
610 <<
"t1, t2, t3, t4 (mm) "
611 << t1/
mm <<
", " << t2/
mm <<
", " << t3/
mm <<
", " << t4/
mm;
612 G4Exception(
"G4Tet::DistanceToOut(p,v,...)",
"GeomSolids1002",
619 else if(calcNorm && n)
627 if(validNorm) { *validNorm=
true; }
651 return (tmin <
fTol)? 0:tmin;
666 vertices->reserve(4);
682 "Error in allocation of vertices. Out of memory !");
702 return new G4Tet(*
this);
711 G4int oldprc = os.precision(16);
712 os <<
"-----------------------------------------------------------\n"
713 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
714 <<
" ===================================================\n"
715 <<
" Solid type: G4Tet\n"
718 <<
" p2: " <<
fP2/
mm <<
" mm \n"
719 <<
" p3: " <<
fP3/
mm <<
" mm \n"
720 <<
" p4: " <<
fP4/
mm <<
" mm \n"
725 <<
"-----------------------------------------------------------\n";
726 os.precision(oldprc);
750 area = 0.5*(v.cross(w)).mag();
752 return (p2 + lambda1*w + lambda2*v);
761 G4double chose,aOne,aTwo,aThree,aFour;
770 if( (chose>=0.) && (chose <aOne) ) {
return p1;}
771 else if( (chose>=aOne) && (chose < aOne+aTwo) ) {
return p2;}
772 else if( (chose>=aOne+aTwo) && (chose<aOne+aTwo+aThree) ) {
return p3;}
782 std::vector<G4ThreeVector> vertices(4);
837 const G4int faces[4][4]={{1,3,2,0},{1,4,3,0},{1,2,4,0},{2,3,4,0}};
839 xyz[1][0]=
fP2.x(); xyz[1][1]=
fP2.y(); xyz[1][2]=
fP2.z();
840 xyz[2][0]=
fP3.x(); xyz[2][1]=
fP3.y(); xyz[2][2]=
fP3.z();
841 xyz[3][0]=
fP4.x(); xyz[3][1]=
fP4.y(); xyz[3][2]=
fP4.z();
843 ph->createPolyhedron(4,4,xyz,faces);
ThreeVector shoot(const G4int Ap, const G4int Af)
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
static const G4double kInfinity
G4double GetMinYExtent() const
CLHEP::Hep3Vector G4ThreeVector
G4ThreeVector GetPointOnSurface() const
G4bool IsYLimited() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4GeometryType GetEntityType() const
G4bool IsXLimited() const
virtual void AddSolid(const G4Box &)=0
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
static double normal(HepRandomEngine *eptr)
std::vector< G4ThreeVector > GetVertices() const
G4double GetMaxXExtent() const
G4double GetMinZExtent() const
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4ThreeVector GetPointOnFace(G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4double &area) const
static G4bool CheckDegeneracy(G4ThreeVector anchor, G4ThreeVector p2, G4ThreeVector p3, G4ThreeVector p4)
std::vector< G4ThreeVector > G4ThreeVectorList
G4Polyhedron * CreatePolyhedron() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double GetMinXExtent() const
G4double GetMaxZExtent() const
std::ostream & StreamInfo(std::ostream &os) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double GetCubicVolume()
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double GetSurfaceArea()
EInside Inside(const G4ThreeVector &p) const
G4VisExtent GetExtent() const
G4double GetMaxYExtent() const
static const char CVSVers[]
G4VSolid & operator=(const G4VSolid &rhs)
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
G4Tet & operator=(const G4Tet &rhs)
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
G4bool IsZLimited() const
G4Polyhedron * fpPolyhedron
G4Polyhedron * GetPolyhedron() const
G4Tet(const G4String &pName, G4ThreeVector anchor, G4ThreeVector p2, G4ThreeVector p3, G4ThreeVector p4, G4bool *degeneracyFlag=0)
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const