59 #if !defined(G4GEOM_USE_UTET) 61 const char G4Tet::CVSVers[]=
"$Id: G4Tet.cc 102297 2017-01-20 13:33:54Z gcosmo $";
85 using namespace CLHEP;
101 :
G4VSolid(pName), fRebuildPolyhedron(false), fpPolyhedron(0), warningFlag(0)
144 if(degeneracyFlag) *degeneracyFlag=degenerate;
148 "Degenerate tetrahedron not allowed.");
151 fTol=1
e-9*(std::fabs(
fXMin)+std::fabs(fXMax)+std::fabs(fYMin)
152 +std::fabs(fYMax)+std::fabs(fZMin)+std::fabs(fZMax));
199 fAnchor(0,0,0),
fP2(0,0,0),
fP3(0,0,0),
fP4(0,0,0),
fMiddle(0,0,0),
246 if (
this == &rhs) {
return *
this; }
281 G4Tet *
object=
new G4Tet(
"temp",anchor,p2,p3,p4,&result);
328 xMin = xoffset +
fXMin;
329 xMax = xoffset +
fXMax;
331 yMin = yoffset +
fYMin;
332 yMax = yoffset +
fYMax;
334 zMin = zoffset +
fZMin;
335 zMax = zoffset +
fZMax;
463 if( noSurfaces == 1 )
469 return sumnorm.
unit();
475 if( (r123<=r134) && (r123<=r142) && (r123<=r234) ) {
return fNormal123; }
476 else if ( (r134<=r142) && (r134<=r234) ) {
return fNormal134; }
499 if( (t>=-
fTol) && (t<tmin) )
501 hp=p+vu*(t+extraDistance);
515 if( (t>=-
fTol) && (t<tmin) )
517 hp=p+vu*(t+extraDistance);
531 if( (t>=-
fTol) && (t<tmin) )
533 hp=p+vu*(t+extraDistance);
547 if( (t>=-
fTol) && (t<tmin) )
549 hp=p+vu*(t+extraDistance);
616 std::ostringstream message;
617 message <<
"No good intersection found or already outside!?" <<
G4endl 618 <<
"p = " << p /
mm <<
"mm" <<
G4endl 620 <<
"t1, t2, t3, t4 (mm) " 621 << t1/
mm <<
", " << t2/
mm <<
", " << t3/
mm <<
", " << t4/
mm;
622 G4Exception(
"G4Tet::DistanceToOut(p,v,...)",
"GeomSolids1002",
629 else if(calcNorm && n)
637 if(validNorm) { *validNorm=
true; }
661 return (tmin <
fTol)? 0:tmin;
676 vertices->reserve(4);
692 "Error in allocation of vertices. Out of memory !");
712 return new G4Tet(*
this);
721 G4int oldprc = os.precision(16);
722 os <<
"-----------------------------------------------------------\n" 723 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n" 724 <<
" ===================================================\n" 725 <<
" Solid type: G4Tet\n" 728 <<
" p2: " <<
fP2/
mm <<
" mm \n" 729 <<
" p3: " <<
fP3/
mm <<
" mm \n" 730 <<
" p4: " <<
fP4/
mm <<
" mm \n" 735 <<
"-----------------------------------------------------------\n";
736 os.precision(oldprc);
760 area = 0.5*(v.
cross(w)).mag();
762 return (p2 + lambda1*w + lambda2*v);
771 G4double chose,aOne,aTwo,aThree,aFour;
780 if( (chose>=0.) && (chose <aOne) ) {
return p1;}
781 else if( (chose>=aOne) && (chose < aOne+aTwo) ) {
return p2;}
782 else if( (chose>=aOne+aTwo) && (chose<aOne+aTwo+aThree) ) {
return p3;}
792 std::vector<G4ThreeVector> vertices(4);
847 const G4int faces[4][4]={{1,3,2,0},{1,4,3,0},{1,2,4,0},{2,3,4,0}};
849 xyz[1][0]=
fP2.
x(); xyz[1][1]=
fP2.
y(); xyz[1][2]=
fP2.
z();
850 xyz[2][0]=
fP3.
x(); xyz[2][1]=
fP3.
y(); xyz[2][2]=
fP3.
z();
851 xyz[3][0]=
fP4.
x(); xyz[3][1]=
fP4.
y(); xyz[3][2]=
fP4.
z();
G4ThreeVector GetPointOnFace(G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4double &area) const
ThreeVector shoot(const G4int Ap, const G4int Af)
G4double GetMinXExtent() const
G4bool fRebuildPolyhedron
static const G4double kInfinity
G4double GetMinYExtent() const
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
CLHEP::Hep3Vector G4ThreeVector
G4int createPolyhedron(G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])
G4double GetMinZExtent() const
G4bool IsYLimited() const
std::vector< G4ThreeVector > GetVertices() const
G4bool IsXLimited() const
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
G4GeometryType GetEntityType() const
G4Polyhedron * CreatePolyhedron() const
virtual void AddSolid(const G4Box &)=0
G4double GetMaxZExtent() const
#define G4MUTEX_INITIALIZER
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
static double normal(HepRandomEngine *eptr)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
G4double GetMaxXExtent() const
std::ostream & StreamInfo(std::ostream &os) const
G4ThreeVector GetPointOnSurface() const
Hep3Vector cross(const Hep3Vector &) const
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
static G4bool CheckDegeneracy(G4ThreeVector anchor, G4ThreeVector p2, G4ThreeVector p3, G4ThreeVector p4)
std::vector< G4ThreeVector > G4ThreeVectorList
EInside Inside(const G4ThreeVector &p) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
double dot(const Hep3Vector &) const
G4Polyhedron * GetPolyhedron() const
G4bool IsZLimited() const
static G4int GetNumberOfRotationSteps()
G4double GetCubicVolume()
G4double GetSurfaceArea()
static const char CVSVers[]
G4VSolid & operator=(const G4VSolid &rhs)
G4Tet & operator=(const G4Tet &rhs)
G4double GetMaxYExtent() const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
G4VisExtent GetExtent() const
G4Polyhedron * fpPolyhedron
G4Tet(const G4String &pName, G4ThreeVector anchor, G4ThreeVector p2, G4ThreeVector p3, G4ThreeVector p4, G4bool *degeneracyFlag=0)