Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VFacet Class Referenceabstract

G4VFacet is a base class defining the facets which are components of a G4TessellatedSolid shape. More...

#include <G4VFacet.hh>

Inheritance diagram for G4VFacet:

Public Member Functions

 G4VFacet ()
virtual ~G4VFacet ()=default
G4bool operator== (const G4VFacet &right) const
virtual G4int GetNumberOfVertices () const =0
virtual G4ThreeVector GetVertex (G4int i) const =0
virtual void SetVertex (G4int i, const G4ThreeVector &val)=0
virtual void SetVertices (std::vector< G4ThreeVector > *vertices)=0
virtual G4GeometryType GetEntityType () const =0
virtual G4ThreeVector GetSurfaceNormal () const =0
virtual G4bool IsDefined () const =0
virtual G4ThreeVector GetCircumcentre () const =0
virtual G4double GetRadius () const =0
virtual G4VFacetGetClone ()=0
virtual G4double Distance (const G4ThreeVector &, G4double minDist)=0
virtual G4double Distance (const G4ThreeVector &, G4double minDist, const G4bool)=0
virtual G4double Extent (const G4ThreeVector axis)=0
virtual G4bool Intersect (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool outgoing, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal)=0
virtual G4double GetArea () const =0
virtual G4ThreeVector GetPointOnFace () const =0
void ApplyTranslation (const G4ThreeVector &v)
std::ostream & StreamInfo (std::ostream &os) const
G4bool IsInside (const G4ThreeVector &p) const
virtual G4int AllocatedMemory ()=0
virtual void SetVertexIndex (G4int i, G4int j)=0
virtual G4int GetVertexIndex (G4int i) const =0

Protected Attributes

G4double kCarTolerance

Static Protected Attributes

static const G4double dirTolerance = 1.0E-14

Detailed Description

G4VFacet is a base class defining the facets which are components of a G4TessellatedSolid shape.

Definition at line 55 of file G4VFacet.hh.

Constructor & Destructor Documentation

◆ G4VFacet()

◆ ~G4VFacet()

virtual G4VFacet::~G4VFacet ( )
virtualdefault

Member Function Documentation

◆ AllocatedMemory()

virtual G4int G4VFacet::AllocatedMemory ( )
pure virtual

Logger methods for allocated memory of facets.

Implemented in G4TriangularFacet.

Referenced by G4TessellatedSolid::AllocatedMemoryWithoutVoxels().

◆ ApplyTranslation()

void G4VFacet::ApplyTranslation ( const G4ThreeVector & v)

Adds a translation 'v' to the vertices of the facet.

Definition at line 85 of file G4VFacet.cc.

86{
88 for (G4int i = 0; i < n; ++i)
89 {
90 SetVertex(i, GetVertex(i) + v);
91 }
92}
int G4int
Definition G4Types.hh:85
virtual G4ThreeVector GetVertex(G4int i) const =0
virtual G4int GetNumberOfVertices() const =0
virtual void SetVertex(G4int i, const G4ThreeVector &val)=0

◆ Distance() [1/2]

virtual G4double G4VFacet::Distance ( const G4ThreeVector & ,
G4double minDist )
pure virtual

◆ Distance() [2/2]

virtual G4double G4VFacet::Distance ( const G4ThreeVector & ,
G4double minDist,
const G4bool  )
pure virtual

Determines the distance to point 'p'. kInfinity is returned if either: (1) outgoing is TRUE and the dot product of the normal vector to the facet and the displacement vector from p to the triangle is negative. (2) outgoing is FALSE and the dot product of the normal vector to the facet and the displacement vector from p to the triangle is positive.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

◆ Extent()

virtual G4double G4VFacet::Extent ( const G4ThreeVector axis)
pure virtual

Calculates the furthest the triangle extends in fA particular direction defined by the vector axis.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

◆ GetArea()

virtual G4double G4VFacet::GetArea ( ) const
pure virtual

Auxiliary method for returning the surface area.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

Referenced by G4TessellatedSolid::CheckStructure(), G4TessellatedSolid::GetCubicVolume(), and G4TessellatedSolid::GetSurfaceArea().

◆ GetCircumcentre()

virtual G4ThreeVector G4VFacet::GetCircumcentre ( ) const
pure virtual

Returns the circumcentre point of the facet.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

Referenced by G4TessellatedSolid::AddFacet(), and operator==().

◆ GetClone()

virtual G4VFacet * G4VFacet::GetClone ( )
pure virtual

Returns a pointer to a newly allocated duplicate copy of the facet.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

Referenced by G4TessellatedSolid::operator+=().

◆ GetEntityType()

virtual G4GeometryType G4VFacet::GetEntityType ( ) const
pure virtual

Returns the type ID of the facet.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

Referenced by StreamInfo().

◆ GetNumberOfVertices()

virtual G4int G4VFacet::GetNumberOfVertices ( ) const
pure virtual

◆ GetPointOnFace()

virtual G4ThreeVector G4VFacet::GetPointOnFace ( ) const
pure virtual

Auxiliary method to get a uniform random point on the facet.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

◆ GetRadius()

virtual G4double G4VFacet::GetRadius ( ) const
pure virtual

Returns the radius to the anchor point and centered on the circumcentre.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

◆ GetSurfaceNormal()

virtual G4ThreeVector G4VFacet::GetSurfaceNormal ( ) const
pure virtual

◆ GetVertex()

◆ GetVertexIndex()

virtual G4int G4VFacet::GetVertexIndex ( G4int i) const
pure virtual

◆ Intersect()

virtual G4bool G4VFacet::Intersect ( const G4ThreeVector & p,
const G4ThreeVector & v,
const G4bool outgoing,
G4double & distance,
G4double & distFromSurface,
G4ThreeVector & normal )
pure virtual

Finds the next intersection when going from 'p' in the direction of 'v'. If 'outgoing' is true, only consider the face if we are going out through the face; otherwise, if false, only consider the face if we are going in through the face.

Returns
true if there is an intersection, false otherwise.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

◆ IsDefined()

virtual G4bool G4VFacet::IsDefined ( ) const
pure virtual

Returns true if the facet is defined.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

Referenced by G4TessellatedSolid::AddFacet().

◆ IsInside()

G4bool G4VFacet::IsInside ( const G4ThreeVector & p) const

Returns true if point 'p' is inside the facet.

Definition at line 114 of file G4VFacet.cc.

115{
116 G4ThreeVector d = p-GetVertex(0);
117 G4double displacement = d.dot(GetSurfaceNormal());
118 return displacement <= 0.0;
119}
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
double dot(const Hep3Vector &) const
virtual G4ThreeVector GetSurfaceNormal() const =0

◆ operator==()

G4bool G4VFacet::operator== ( const G4VFacet & right) const

Equality operator.

Definition at line 51 of file G4VFacet.cc.

52{
53 G4double tolerance = kCarTolerance*kCarTolerance/4.0;
54
56 {
57 return false;
58 }
59 if ((GetCircumcentre()-right.GetCircumcentre()).mag2() > tolerance)
60 {
61 return false;
62 }
63 if (std::fabs((right.GetSurfaceNormal()).dot(GetSurfaceNormal())) < 0.9999999999)
64 {
65 return false;
66 }
67
68 G4bool coincident = true;
69 G4int i = 0;
70 do // Loop checking, 13.08.2015, G.Cosmo
71 {
72 coincident = false;
73 G4int j = 0;
74 do // Loop checking, 13.08.2015, G.Cosmo
75 {
76 coincident = (GetVertex(i)-right.GetVertex(j)).mag2() < tolerance;
77 } while (!coincident && ++j < GetNumberOfVertices());
78 } while (coincident && ++i < GetNumberOfVertices());
79
80 return coincident;
81}
bool G4bool
Definition G4Types.hh:86
virtual G4ThreeVector GetCircumcentre() const =0

◆ SetVertex()

virtual void G4VFacet::SetVertex ( G4int i,
const G4ThreeVector & val )
pure virtual

Methods to set the vertices.

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

Referenced by ApplyTranslation().

◆ SetVertexIndex()

virtual void G4VFacet::SetVertexIndex ( G4int i,
G4int j )
pure virtual

Implemented in G4TriangularFacet.

◆ SetVertices()

virtual void G4VFacet::SetVertices ( std::vector< G4ThreeVector > * vertices)
pure virtual

Implemented in G4QuadrangularFacet, and G4TriangularFacet.

◆ StreamInfo()

std::ostream & G4VFacet::StreamInfo ( std::ostream & os) const

Streams the object contents to an output stream.

Definition at line 96 of file G4VFacet.cc.

97{
98 os << G4endl;
99 os << "*********************************************************************"
100 << G4endl;
101 os << "FACET TYPE = " << GetEntityType() << G4endl;
102 os << "ABSOLUTE VECTORS = " << G4endl;
104 for (G4int i = 0; i < n; ++i)
105 {
106 os << "P[" << i << "] = " << GetVertex(i) << G4endl;
107 }
108 os << "*********************************************************************"
109 << G4endl;
110
111 return os;
112}
#define G4endl
Definition G4ios.hh:67
virtual G4GeometryType GetEntityType() const =0

Referenced by G4TessellatedSolid::AddFacet(), and G4TessellatedSolid::StreamInfo().

Member Data Documentation

◆ dirTolerance

const G4double G4VFacet::dirTolerance = 1.0E-14
staticprotected

Definition at line 184 of file G4VFacet.hh.

Referenced by G4QuadrangularFacet::Distance(), and G4TriangularFacet::Intersect().

◆ kCarTolerance


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