Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Tet Class Reference

#include <G4Tet.hh>

+ Inheritance diagram for G4Tet:

Public Member Functions

 G4Tet (const G4String &pName, const G4ThreeVector &anchor, const G4ThreeVector &p1, const G4ThreeVector &p2, const G4ThreeVector &p3, G4bool *degeneracyFlag=nullptr)
 
virtual ~G4Tet ()
 
void SetVertices (const G4ThreeVector &anchor, const G4ThreeVector &p1, const G4ThreeVector &p2, const G4ThreeVector &p3)
 
void GetVertices (G4ThreeVector &anchor, G4ThreeVector &p1, G4ThreeVector &p2, G4ThreeVector &p3) const
 
std::vector< G4ThreeVectorGetVertices () const
 
void PrintWarnings (G4bool)
 
G4bool CheckDegeneracy (const G4ThreeVector &p0, const G4ThreeVector &p1, const G4ThreeVector &p2, const G4ThreeVector &p3) const
 
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const
 
EInside Inside (const G4ThreeVector &p) const
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 
G4double DistanceToIn (const G4ThreeVector &p) const
 
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const
 
G4double DistanceToOut (const G4ThreeVector &p) const
 
G4GeometryType GetEntityType () const
 
G4VSolidClone () const
 
std::ostream & StreamInfo (std::ostream &os) const
 
G4double GetCubicVolume ()
 
G4double GetSurfaceArea ()
 
G4ThreeVector GetPointOnSurface () const
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4VisExtent GetExtent () const
 
G4PolyhedronCreatePolyhedron () const
 
G4PolyhedronGetPolyhedron () const
 
 G4Tet (__void__ &)
 
 G4Tet (const G4Tet &rhs)
 
G4Tetoperator= (const G4Tet &rhs)
 
- Public Member Functions inherited from G4VSolid
 G4VSolid (const G4String &name)
 
virtual ~G4VSolid ()
 
G4bool operator== (const G4VSolid &s) const
 
G4String GetName () const
 
void SetName (const G4String &name)
 
G4double GetTolerance () const
 
virtual void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
virtual G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
 
virtual EInside Inside (const G4ThreeVector &p) const =0
 
virtual G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const =0
 
virtual G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const =0
 
virtual G4double DistanceToIn (const G4ThreeVector &p) const =0
 
virtual G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
 
virtual G4double DistanceToOut (const G4ThreeVector &p) const =0
 
virtual void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
virtual G4double GetCubicVolume ()
 
virtual G4double GetSurfaceArea ()
 
virtual G4GeometryType GetEntityType () const =0
 
virtual G4ThreeVector GetPointOnSurface () const
 
virtual G4VSolidClone () const
 
virtual std::ostream & StreamInfo (std::ostream &os) const =0
 
void DumpInfo () const
 
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const =0
 
virtual G4VisExtent GetExtent () const
 
virtual G4PolyhedronCreatePolyhedron () const
 
virtual G4PolyhedronGetPolyhedron () const
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
 G4VSolid (__void__ &)
 
 G4VSolid (const G4VSolid &rhs)
 
G4VSolidoperator= (const G4VSolid &rhs)
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VSolid
void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipCrossSection (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipBetweenSections (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipPolygon (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Detailed Description

Definition at line 55 of file G4Tet.hh.

Constructor & Destructor Documentation

◆ G4Tet() [1/3]

G4Tet::G4Tet ( const G4String pName,
const G4ThreeVector anchor,
const G4ThreeVector p1,
const G4ThreeVector p2,
const G4ThreeVector p3,
G4bool degeneracyFlag = nullptr 
)

Definition at line 66 of file G4Tet.cc.

71 : G4VSolid(pName)
72{
73 // Check for degeneracy
74 G4bool degenerate = CheckDegeneracy(p0, p1, p2, p3);
75 if (degeneracyFlag)
76 {
77 *degeneracyFlag = degenerate;
78 }
79 else if (degenerate)
80 {
81 std::ostringstream message;
82 message << "Degenerate tetrahedron: " << GetName() << " !\n"
83 << " anchor: " << p0 << "\n"
84 << " p1 : " << p1 << "\n"
85 << " p2 : " << p2 << "\n"
86 << " p3 : " << p3 << "\n"
87 << " volume: "
88 << std::abs((p1 - p0).cross(p2 - p0).dot(p3 - p0))/6.;
89 G4Exception("G4Tet::G4Tet()", "GeomSolids0002", FatalException, message);
90 }
91
92 // Define surface thickness
93 halfTolerance = 0.5 * kCarTolerance;
94
95 // Set data members
96 Initialize(p0, p1, p2, p3);
97}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
bool G4bool
Definition: G4Types.hh:86
G4bool CheckDegeneracy(const G4ThreeVector &p0, const G4ThreeVector &p1, const G4ThreeVector &p2, const G4ThreeVector &p3) const
Definition: G4Tet.cc:173
G4String GetName() const
G4double kCarTolerance
Definition: G4VSolid.hh:302

◆ ~G4Tet()

G4Tet::~G4Tet ( )
virtual

Definition at line 113 of file G4Tet.cc.

114{
115 delete fpPolyhedron; fpPolyhedron = nullptr;
116}

◆ G4Tet() [2/3]

G4Tet::G4Tet ( __void__ &  a)

Definition at line 104 of file G4Tet.cc.

105 : G4VSolid(a)
106{
107}

◆ G4Tet() [3/3]

G4Tet::G4Tet ( const G4Tet rhs)

Definition at line 122 of file G4Tet.cc.

123 : G4VSolid(rhs)
124{
125 halfTolerance = rhs.halfTolerance;
126 fCubicVolume = rhs.fCubicVolume;
127 fSurfaceArea = rhs.fSurfaceArea;
128 for (G4int i = 0; i < 4; ++i) { fVertex[i] = rhs.fVertex[i]; }
129 for (G4int i = 0; i < 4; ++i) { fNormal[i] = rhs.fNormal[i]; }
130 for (G4int i = 0; i < 4; ++i) { fDist[i] = rhs.fDist[i]; }
131 for (G4int i = 0; i < 4; ++i) { fArea[i] = rhs.fArea[i]; }
132 fBmin = rhs.fBmin;
133 fBmax = rhs.fBmax;
134}
int G4int
Definition: G4Types.hh:85

Member Function Documentation

◆ BoundingLimits()

void G4Tet::BoundingLimits ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 319 of file G4Tet.cc.

320{
321 pMin = fBmin;
322 pMax = fBmax;
323}

Referenced by CalculateExtent().

◆ CalculateExtent()

G4bool G4Tet::CalculateExtent ( const EAxis  pAxis,
const G4VoxelLimits pVoxelLimit,
const G4AffineTransform pTransform,
G4double pmin,
G4double pmax 
) const
virtual

Implements G4VSolid.

Definition at line 329 of file G4Tet.cc.

333{
334 G4ThreeVector bmin, bmax;
335
336 // Check bounding box (bbox)
337 //
338 BoundingLimits(bmin,bmax);
339 G4BoundingEnvelope bbox(bmin,bmax);
340
341 // Use simple bounding-box to help in the case of complex 3D meshes
342 //
343 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
344
345#if 0
346 // Precise extent computation (disabled by default for this shape)
347 //
348 G4bool exist;
349 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
350 {
351 return exist = (pMin < pMax) ? true : false;
352 }
353
354 // Set bounding envelope (benv) and calculate extent
355 //
356 std::vector<G4ThreeVector> vec = GetVertices();
357
358 G4ThreeVectorList anchor(1);
359 anchor[0].set(vec[0].x(),vec[0].y(),vec[0].z());
360
361 G4ThreeVectorList base(3);
362 base[0].set(vec[1].x(),vec[1].y(),vec[1].z());
363 base[1].set(vec[2].x(),vec[2].y(),vec[2].z());
364 base[2].set(vec[3].x(),vec[3].y(),vec[3].z());
365
366 std::vector<const G4ThreeVectorList *> polygons(2);
367 polygons[0] = &anchor;
368 polygons[1] = &base;
369
370 G4BoundingEnvelope benv(bmin,bmax,polygons);
371 return exists = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
372#endif
373}
std::vector< G4ThreeVector > G4ThreeVectorList
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Tet.cc:319
std::vector< G4ThreeVector > GetVertices() const
Definition: G4Tet.cc:297

◆ CheckDegeneracy()

G4bool G4Tet::CheckDegeneracy ( const G4ThreeVector p0,
const G4ThreeVector p1,
const G4ThreeVector p2,
const G4ThreeVector p3 
) const

Definition at line 173 of file G4Tet.cc.

177{
178 G4double hmin = 4. * kCarTolerance; // degeneracy tolerance
179
180 // Calculate volume
181 G4double vol = std::abs((p1 - p0).cross(p2 - p0).dot(p3 - p0));
182
183 // Calculate face areas squared
184 G4double ss[4];
185 ss[0] = ((p1 - p0).cross(p2 - p0)).mag2();
186 ss[1] = ((p2 - p0).cross(p3 - p0)).mag2();
187 ss[2] = ((p3 - p0).cross(p1 - p0)).mag2();
188 ss[3] = ((p2 - p1).cross(p3 - p1)).mag2();
189
190 // Find face with max area
191 G4int k = 0;
192 for (G4int i = 1; i < 4; ++i) { if (ss[i] > ss[k]) k = i; }
193
194 // Check: vol^2 / s^2 <= hmin^2
195 return (vol*vol <= ss[k]*hmin*hmin);
196}
double G4double
Definition: G4Types.hh:83

Referenced by G4Tet(), and SetVertices().

◆ Clone()

G4VSolid * G4Tet::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 553 of file G4Tet.cc.

554{
555 return new G4Tet(*this);
556}
Definition: G4Tet.hh:56

◆ ComputeDimensions()

void G4Tet::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtual

Reimplemented from G4VSolid.

Definition at line 309 of file G4Tet.cc.

312{
313}

◆ CreatePolyhedron()

G4Polyhedron * G4Tet::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 646 of file G4Tet.cc.

647{
648 // Check orientation of vertices
649 G4ThreeVector v1 = fVertex[1] - fVertex[0];
650 G4ThreeVector v2 = fVertex[2] - fVertex[0];
651 G4ThreeVector v3 = fVertex[3] - fVertex[0];
652 G4bool invert = v1.cross(v2).dot(v3) < 0.;
653 G4int k2 = (invert) ? 3 : 2;
654 G4int k3 = (invert) ? 2 : 3;
655
656 // Set coordinates of vertices
657 G4double xyz[4][3];
658 for (G4int i = 0; i < 3; ++i)
659 {
660 xyz[0][i] = fVertex[0][i];
661 xyz[1][i] = fVertex[1][i];
662 xyz[2][i] = fVertex[k2][i];
663 xyz[3][i] = fVertex[k3][i];
664 }
665
666 // Create polyhedron
667 G4int faces[4][4] = { {1,3,2,0}, {1,4,3,0}, {1,2,4,0}, {2,3,4,0} };
668 G4Polyhedron* ph = new G4Polyhedron;
669 ph->createPolyhedron(4,4,xyz,faces);
670
671 return ph;
672}
Hep3Vector cross(const Hep3Vector &) const
double dot(const Hep3Vector &) const
G4int createPolyhedron(G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])

Referenced by G4ArrowModel::G4ArrowModel(), and GetPolyhedron().

◆ DescribeYourselfTo()

void G4Tet::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 626 of file G4Tet.cc.

627{
628 scene.AddSolid (*this);
629}
virtual void AddSolid(const G4Box &)=0

◆ DistanceToIn() [1/2]

G4double G4Tet::DistanceToIn ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 474 of file G4Tet.cc.

475{
476 G4double dd[4];
477 for (G4int i = 0; i < 4; ++i) { dd[i] = fNormal[i].dot(p) - fDist[i]; }
478
479 G4double dist = std::max(std::max(std::max(dd[0], dd[1]), dd[2]), dd[3]);
480 return (dist > 0.) ? dist : 0.;
481}

◆ DistanceToIn() [2/2]

G4double G4Tet::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const
virtual

Implements G4VSolid.

Definition at line 447 of file G4Tet.cc.

449{
450 G4double tin = -DBL_MAX, tout = DBL_MAX;
451 for (G4int i = 0; i < 4; ++i)
452 {
453 G4double cosa = fNormal[i].dot(v);
454 G4double dist = fNormal[i].dot(p) - fDist[i];
455 if (dist >= -halfTolerance)
456 {
457 if (cosa >= 0.) { return kInfinity; }
458 tin = std::max(tin, -dist/cosa);
459 }
460 else if (cosa > 0.)
461 {
462 tout = std::min(tout, -dist/cosa);
463 }
464 }
465
466 return (tout - tin <= halfTolerance) ?
467 kInfinity : ((tin < halfTolerance) ? 0. : tin);
468}
#define DBL_MAX
Definition: templates.hh:62

◆ DistanceToOut() [1/2]

G4double G4Tet::DistanceToOut ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 531 of file G4Tet.cc.

532{
533 G4double dd[4];
534 for (G4int i = 0; i < 4; ++i) { dd[i] = fDist[i] - fNormal[i].dot(p); }
535
536 G4double dist = std::min(std::min(std::min(dd[0], dd[1]), dd[2]), dd[3]);
537 return (dist > 0.) ? dist : 0.;
538}

◆ DistanceToOut() [2/2]

G4double G4Tet::DistanceToOut ( const G4ThreeVector p,
const G4ThreeVector v,
const G4bool  calcNorm = false,
G4bool validNorm = nullptr,
G4ThreeVector n = nullptr 
) const
virtual

Implements G4VSolid.

Definition at line 487 of file G4Tet.cc.

492{
493 // Calculate distances and cosines
494 G4double cosa[4], dist[4];
495 G4int ind[4] = {0}, nside = 0;
496 for (G4int i = 0; i < 4; ++i)
497 {
498 G4double tmp = fNormal[i].dot(v);
499 cosa[i] = tmp;
500 ind[nside] = (tmp > 0) * i;
501 nside += (tmp > 0);
502 dist[i] = fNormal[i].dot(p) - fDist[i];
503 }
504
505 // Find intersection (in most of cases nside == 1)
506 G4double tout = DBL_MAX;
507 G4int iside = 0;
508 for (G4int i = 0; i < nside; ++i)
509 {
510 G4int k = ind[i];
511 // Check: leaving the surface
512 if (dist[k] >= -halfTolerance) { tout = 0.; iside = k; break; }
513 // Compute distance to intersection
514 G4double tmp = -dist[k]/cosa[k];
515 if (tmp < tout) { tout = tmp; iside = k; }
516 }
517
518 // Set normal, if required, and return distance to out
519 if (calcNorm)
520 {
521 *validNorm = true;
522 *n = fNormal[iside];
523 }
524 return tout;
525}

◆ GetCubicVolume()

G4double G4Tet::GetCubicVolume ( )
virtual

Reimplemented from G4VSolid.

Definition at line 608 of file G4Tet.cc.

609{
610 return fCubicVolume;
611}

◆ GetEntityType()

G4GeometryType G4Tet::GetEntityType ( ) const
virtual

Implements G4VSolid.

Definition at line 544 of file G4Tet.cc.

545{
546 return G4String("G4Tet");
547}

Referenced by StreamInfo().

◆ GetExtent()

G4VisExtent G4Tet::GetExtent ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 635 of file G4Tet.cc.

636{
637 return G4VisExtent(fBmin.x(), fBmax.x(),
638 fBmin.y(), fBmax.y(),
639 fBmin.z(), fBmax.z());
640}
double z() const
double x() const
double y() const

◆ GetPointOnSurface()

G4ThreeVector G4Tet::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 583 of file G4Tet.cc.

584{
585 constexpr G4int iface[4][3] = { {0,1,2}, {0,2,3}, {0,3,1}, {1,2,3} };
586
587 // Select face
588 G4double select = fSurfaceArea*G4QuickRand();
589 G4int i = 0;
590 for ( ; i < 4; ++i) { if ((select -= fArea[i]) <= 0.) break; }
591
592 // Set selected triangle
593 G4ThreeVector p0 = fVertex[iface[i][0]];
594 G4ThreeVector e1 = fVertex[iface[i][1]] - p0;
595 G4ThreeVector e2 = fVertex[iface[i][2]] - p0;
596
597 // Return random point
598 G4double r1 = G4QuickRand();
599 G4double r2 = G4QuickRand();
600 return (r1 + r2 > 1.) ?
601 p0 + e1*(1. - r1) + e2*(1. - r2) : p0 + e1*r1 + e2*r2;
602}
G4double G4QuickRand()
Definition: G4QuickRand.hh:34

◆ GetPolyhedron()

G4Polyhedron * G4Tet::GetPolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 678 of file G4Tet.cc.

679{
680 if (fpPolyhedron == nullptr ||
681 fRebuildPolyhedron ||
683 fpPolyhedron->GetNumberOfRotationSteps())
684 {
685 G4AutoLock l(&polyhedronMutex);
686 delete fpPolyhedron;
687 fpPolyhedron = CreatePolyhedron();
688 fRebuildPolyhedron = false;
689 l.unlock();
690 }
691 return fpPolyhedron;
692}
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4Polyhedron * CreatePolyhedron() const
Definition: G4Tet.cc:646
static G4int GetNumberOfRotationSteps()

◆ GetSurfaceArea()

G4double G4Tet::GetSurfaceArea ( )
virtual

Reimplemented from G4VSolid.

Definition at line 617 of file G4Tet.cc.

618{
619 return fSurfaceArea;
620}

◆ GetVertices() [1/2]

std::vector< G4ThreeVector > G4Tet::GetVertices ( ) const

Definition at line 297 of file G4Tet.cc.

298{
299 std::vector<G4ThreeVector> vertices(4);
300 for (G4int i = 0; i < 4; ++i) { vertices[i] = fVertex[i]; }
301 return vertices;
302}

Referenced by CalculateExtent().

◆ GetVertices() [2/2]

void G4Tet::GetVertices ( G4ThreeVector anchor,
G4ThreeVector p1,
G4ThreeVector p2,
G4ThreeVector p3 
) const

Definition at line 282 of file G4Tet.cc.

286{
287 p0 = fVertex[0];
288 p1 = fVertex[1];
289 p2 = fVertex[2];
290 p3 = fVertex[3];
291}

Referenced by G4GDMLWriteSolids::TetWrite().

◆ Inside()

EInside G4Tet::Inside ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 379 of file G4Tet.cc.

380{
381 G4double dd[4];
382 for (G4int i = 0; i < 4; ++i) { dd[i] = fNormal[i].dot(p) - fDist[i]; }
383
384 G4double dist = std::max(std::max(std::max(dd[0], dd[1]), dd[2]), dd[3]);
385 return (dist <= -halfTolerance) ?
386 kInside : ((dist <= halfTolerance) ? kSurface : kOutside);
387}
@ kInside
Definition: geomdefs.hh:70
@ kOutside
Definition: geomdefs.hh:68
@ kSurface
Definition: geomdefs.hh:69

◆ operator=()

G4Tet & G4Tet::operator= ( const G4Tet rhs)

Definition at line 140 of file G4Tet.cc.

141{
142 // Check assignment to self
143 //
144 if (this == &rhs) { return *this; }
145
146 // Copy base class data
147 //
149
150 // Copy data
151 //
152 halfTolerance = rhs.halfTolerance;
153 fCubicVolume = rhs.fCubicVolume;
154 fSurfaceArea = rhs.fSurfaceArea;
155 for (G4int i = 0; i < 4; ++i) { fVertex[i] = rhs.fVertex[i]; }
156 for (G4int i = 0; i < 4; ++i) { fNormal[i] = rhs.fNormal[i]; }
157 for (G4int i = 0; i < 4; ++i) { fDist[i] = rhs.fDist[i]; }
158 for (G4int i = 0; i < 4; ++i) { fArea[i] = rhs.fArea[i]; }
159 fBmin = rhs.fBmin;
160 fBmax = rhs.fBmax;
161 fRebuildPolyhedron = false;
162 delete fpPolyhedron; fpPolyhedron = nullptr;
163
164 return *this;
165}
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:98

◆ PrintWarnings()

void G4Tet::PrintWarnings ( G4bool  )
inline

Definition at line 85 of file G4Tet.hh.

85{};

◆ SetVertices()

void G4Tet::SetVertices ( const G4ThreeVector anchor,
const G4ThreeVector p1,
const G4ThreeVector p2,
const G4ThreeVector p3 
)

Definition at line 250 of file G4Tet.cc.

254{
255 // Check for degeneracy
256 G4bool degenerate = CheckDegeneracy(p0, p1, p2, p3);
257 if (degenerate)
258 {
259 std::ostringstream message;
260 message << "Degenerate tetrahedron is not permitted: " << GetName() << " !\n"
261 << " anchor: " << p0 << "\n"
262 << " p1 : " << p1 << "\n"
263 << " p2 : " << p2 << "\n"
264 << " p3 : " << p3 << "\n"
265 << " volume: "
266 << std::abs((p1 - p0).cross(p2 - p0).dot(p3 - p0))/6.;
267 G4Exception("G4Tet::G4SetVertices()", "GeomSolids0002",
268 FatalException, message);
269 }
270
271 // Set data members
272 Initialize(p0, p1, p2, p3);
273
274 // Set flag to rebuild polyhedron
275 fRebuildPolyhedron = true;
276}

◆ StreamInfo()

std::ostream & G4Tet::StreamInfo ( std::ostream &  os) const
virtual

Implements G4VSolid.

Definition at line 562 of file G4Tet.cc.

563{
564 G4int oldprc = os.precision(16);
565 os << "-----------------------------------------------------------\n"
566 << " *** Dump for solid - " << GetName() << " ***\n"
567 << " ===================================================\n"
568 << " Solid type: " << GetEntityType() << "\n"
569 << " Parameters: \n"
570 << " anchor: " << fVertex[0]/mm << " mm\n"
571 << " p1 : " << fVertex[1]/mm << " mm\n"
572 << " p2 : " << fVertex[2]/mm << " mm\n"
573 << " p3 : " << fVertex[3]/mm << " mm\n"
574 << "-----------------------------------------------------------\n";
575 os.precision(oldprc);
576 return os;
577}
G4GeometryType GetEntityType() const
Definition: G4Tet.cc:544

◆ SurfaceNormal()

G4ThreeVector G4Tet::SurfaceNormal ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 393 of file G4Tet.cc.

394{
395 G4double k[4];
396 for (G4int i = 0; i < 4; ++i)
397 {
398 k[i] = std::abs(fNormal[i].dot(p) - fDist[i]) <= halfTolerance;
399 }
400 G4double nsurf = k[0] + k[1] + k[2] + k[3];
401 G4ThreeVector norm =
402 k[0]*fNormal[0] + k[1]*fNormal[1] + k[2]*fNormal[2] + k[3]*fNormal[3];
403
404 if (nsurf == 1.) return norm;
405 else if (nsurf > 1.) return norm.unit(); // edge or vertex
406 {
407#ifdef G4SPECSDEBUG
408 std::ostringstream message;
409 G4int oldprc = message.precision(16);
410 message << "Point p is not on surface (!?) of solid: "
411 << GetName() << "\n";
412 message << "Position:\n";
413 message << " p.x() = " << p.x()/mm << " mm\n";
414 message << " p.y() = " << p.y()/mm << " mm\n";
415 message << " p.z() = " << p.z()/mm << " mm";
416 G4cout.precision(oldprc);
417 G4Exception("G4Tet::SurfaceNormal(p)", "GeomSolids1002",
418 JustWarning, message );
419 DumpInfo();
420#endif
421 return ApproxSurfaceNormal(p);
422 }
423}
@ JustWarning
G4GLOB_DLL std::ostream G4cout
Hep3Vector unit() const
void DumpInfo() const

The documentation for this class was generated from the following files: