Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Protected Attributes
VUFacet Class Referenceabstract

#include <VUFacet.hh>

Public Member Functions

virtual ~VUFacet ()
 
virtual int GetNumberOfVertices () const =0
 
virtual UVector3 GetVertex (int i) const =0
 
virtual void SetVertex (int i, const UVector3 &val)=0
 
virtual UGeometryType GetEntityType () const =0
 
virtual UVector3 GetSurfaceNormal () const =0
 
virtual bool IsDefined () const =0
 
virtual UVector3 GetCircumcentre () const =0
 
virtual double GetRadius () const =0
 
virtual VUFacetGetClone ()=0
 
virtual double Distance (const UVector3 &, const double)=0
 
virtual double Distance (const UVector3 &, const double, const bool)=0
 
virtual double Extent (const UVector3)=0
 
virtual bool Intersect (const UVector3 &, const UVector3 &, const bool, double &, double &, UVector3 &)=0
 
virtual double GetArea ()=0
 
virtual UVector3 GetPointOnFace () const =0
 
bool operator== (const VUFacet &right) const
 
void ApplyTranslation (const UVector3 v)
 
std::ostream & StreamInfo (std::ostream &os) const
 
bool IsInside (const UVector3 &p) const
 
virtual int AllocatedMemory ()=0
 
virtual void SetVertexIndex (const int i, const int j)=0
 
virtual int GetVertexIndex (const int i) const =0
 
virtual void SetVertices (std::vector< UVector3 > *vertices)=0
 

Static Protected Attributes

static const double dirTolerance = 1.0E-14
 
static const double kCarTolerance = VUSolid::Tolerance()
 

Detailed Description

Definition at line 53 of file VUFacet.hh.

Constructor & Destructor Documentation

virtual VUFacet::~VUFacet ( )
inlinevirtual

Definition at line 57 of file VUFacet.hh.

57 {};

Member Function Documentation

virtual int VUFacet::AllocatedMemory ( )
pure virtual
void VUFacet::ApplyTranslation ( const UVector3  v)

Definition at line 70 of file VUFacet.cc.

References n.

71 {
72  int n = GetNumberOfVertices();
73  for (int i = 0; i < n; ++i)
74  SetVertex(i, GetVertex(i) + v);
75 }
virtual void SetVertex(int i, const UVector3 &val)=0
virtual int GetNumberOfVertices() const =0
virtual UVector3 GetVertex(int i) const =0
const G4int n
virtual double VUFacet::Distance ( const UVector3 ,
const double   
)
pure virtual
virtual double VUFacet::Distance ( const UVector3 ,
const double  ,
const bool   
)
pure virtual
virtual double VUFacet::Extent ( const UVector3  )
pure virtual
virtual double VUFacet::GetArea ( )
pure virtual
virtual UVector3 VUFacet::GetCircumcentre ( ) const
pure virtual

Referenced by operator==().

virtual VUFacet* VUFacet::GetClone ( )
pure virtual
virtual UGeometryType VUFacet::GetEntityType ( ) const
pure virtual
virtual int VUFacet::GetNumberOfVertices ( ) const
pure virtual

Referenced by operator==().

virtual UVector3 VUFacet::GetPointOnFace ( ) const
pure virtual
virtual double VUFacet::GetRadius ( ) const
pure virtual
virtual UVector3 VUFacet::GetSurfaceNormal ( ) const
pure virtual

Referenced by operator==().

virtual UVector3 VUFacet::GetVertex ( int  i) const
pure virtual

Referenced by operator==().

virtual int VUFacet::GetVertexIndex ( const int  i) const
pure virtual
virtual bool VUFacet::Intersect ( const UVector3 ,
const UVector3 ,
const bool  ,
double &  ,
double &  ,
UVector3  
)
pure virtual
virtual bool VUFacet::IsDefined ( ) const
pure virtual
bool VUFacet::IsInside ( const UVector3 p) const

Definition at line 100 of file VUFacet.cc.

References UVector3::Dot().

101 {
102  UVector3 d = p - GetVertex(0);
103  double displacement = d.Dot(GetSurfaceNormal());
104  return displacement <= 0.0;
105 }
virtual UVector3 GetVertex(int i) const =0
virtual UVector3 GetSurfaceNormal() const =0
double Dot(const UVector3 &) const
Definition: UVector3.hh:257
bool VUFacet::operator== ( const VUFacet right) const

Definition at line 42 of file VUFacet.cc.

References GetCircumcentre(), GetNumberOfVertices(), GetSurfaceNormal(), and GetVertex().

43 {
44  double tolerance = kCarTolerance*kCarTolerance/4.0;
45 
47  return false;
48  else if ((GetCircumcentre()-right.GetCircumcentre()).Mag2() > tolerance)
49  return false;
50  else if (std::fabs((right.GetSurfaceNormal()).Dot(GetSurfaceNormal())) < 0.9999999999)
51  return false;
52 
53  bool coincident = true;
54  int i = 0;
55  do
56  {
57  coincident = false;
58  int j = 0;
59  do
60  {
61  coincident = (GetVertex(i)-right.GetVertex(j)).Mag2() < tolerance;
62  } while (!coincident && ++j < GetNumberOfVertices());
63  } while (coincident && ++i < GetNumberOfVertices());
64 
65  return coincident;
66 }
virtual int GetNumberOfVertices() const =0
virtual UVector3 GetVertex(int i) const =0
virtual UVector3 GetSurfaceNormal() const =0
virtual UVector3 GetCircumcentre() const =0
static const double kCarTolerance
Definition: VUFacet.hh:89
virtual void VUFacet::SetVertex ( int  i,
const UVector3 val 
)
pure virtual
virtual void VUFacet::SetVertexIndex ( const int  i,
const int  j 
)
pure virtual
virtual void VUFacet::SetVertices ( std::vector< UVector3 > *  vertices)
pure virtual
std::ostream & VUFacet::StreamInfo ( std::ostream &  os) const

Definition at line 79 of file VUFacet.cc.

References n.

80 {
81  os << endl;
82  os << "*********************************************************************" << endl;
83  os << "FACET TYPE = " << GetEntityType() << endl;
84  os << "ABSOLUTE VECTORS = " << endl;
85  int n = GetNumberOfVertices();
86  for (int i = 0; i < n; ++i)
87  os << "P[" << i << "] = " << GetVertex(i) << endl;
88 
89  /*
90  os << "RELATIVE VECTORS = " << endl;
91  for (vector<UVector3>::const_iterator it=E.begin(); it!=E.end(); it++)
92  { os << "E[" << it-E.begin()+1 << "] = " << *it << endl; }
93  */
94 
95  os << "*********************************************************************" << endl;
96 
97  return os;
98 }
virtual int GetNumberOfVertices() const =0
virtual UVector3 GetVertex(int i) const =0
virtual UGeometryType GetEntityType() const =0
const G4int n

Field Documentation

const double VUFacet::dirTolerance = 1.0E-14
staticprotected

Definition at line 88 of file VUFacet.hh.

const double VUFacet::kCarTolerance = VUSolid::Tolerance()
staticprotected

Definition at line 89 of file VUFacet.hh.


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