Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VFacet.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration and of QinetiQ Ltd, *
20// * subject to DEFCON 705 IPR conditions. *
21// * By using, copying, modifying or distributing the software (or *
22// * any work based on the software) you agree to acknowledge its *
23// * use in resulting scientific publications, and indicate your *
24// * acceptance of all terms of the Geant4 Software license. *
25// ********************************************************************
26//
27// G4VFacet
28//
29// Class description:
30//
31// Base class defining the facets which are components of a
32// G4TessellatedSolid shape.
33
34// Author: P.R.Truscott (QinetiQ Ltd, UK), 31.10.2004 - Created.
35// M.Gayer (CERN), 12.10.2012 - Reviewed optimised implementation.
36// --------------------------------------------------------------------
37#ifndef G4VFACET_HH
38#define G4VFACET_HH
39
40#include <iostream>
41#include <vector>
42
43#include "globals.hh"
44#include "windefs.hh"
45#include "G4ThreeVector.hh"
46#include "G4VSolid.hh"
47
49
50/**
51 * @brief G4VFacet is a base class defining the facets which are components
52 * of a G4TessellatedSolid shape.
53 */
54
56{
57 public:
58
59 /**
60 * Constructor and default Destructor.
61 */
62 G4VFacet();
63 virtual ~G4VFacet() = default;
64
65 /**
66 * Equality operator.
67 */
68 G4bool operator== (const G4VFacet& right) const;
69
70 /**
71 * Returns the number of vertices of the facet.
72 */
73 virtual G4int GetNumberOfVertices () const = 0;
74
75 /**
76 * Returns the vertex based on the index 'i'.
77 */
78 virtual G4ThreeVector GetVertex (G4int i) const = 0;
79
80 /**
81 * Methods to set the vertices.
82 */
83 virtual void SetVertex (G4int i, const G4ThreeVector& val) = 0;
84 virtual void SetVertices(std::vector<G4ThreeVector>* vertices) = 0;
85
86 /**
87 * Returns the type ID of the facet.
88 */
89 virtual G4GeometryType GetEntityType () const = 0;
90
91 /**
92 * Returns the normal vector to the facet.
93 */
94 virtual G4ThreeVector GetSurfaceNormal () const = 0;
95
96 /**
97 * Returns true if the facet is defined.
98 */
99 virtual G4bool IsDefined () const = 0;
100
101 /**
102 * Returns the circumcentre point of the facet.
103 */
104 virtual G4ThreeVector GetCircumcentre () const = 0;
105
106 /**
107 * Returns the radius to the anchor point and centered on the circumcentre.
108 */
109 virtual G4double GetRadius () const = 0;
110
111 /**
112 * Returns a pointer to a newly allocated duplicate copy of the facet.
113 */
114 virtual G4VFacet* GetClone () = 0;
115
116 /**
117 * Determines the closest distance between point p and the facet.
118 */
119 virtual G4double Distance (const G4ThreeVector&, G4double minDist) = 0;
120
121 /**
122 * Determines the distance to point 'p'. kInfinity is returned if either:
123 * (1) outgoing is TRUE and the dot product of the normal vector to the
124 * facet and the displacement vector from p to the triangle is negative.
125 * (2) outgoing is FALSE and the dot product of the normal vector to the
126 * facet and the displacement vector from p to the triangle is positive.
127 */
128 virtual G4double Distance (const G4ThreeVector&, G4double minDist,
129 const G4bool) = 0;
130
131 /**
132 * Calculates the furthest the triangle extends in fA particular
133 * direction defined by the vector axis.
134 */
135 virtual G4double Extent (const G4ThreeVector axis) = 0;
136
137 /**
138 * Finds the next intersection when going from 'p' in the direction of 'v'.
139 * If 'outgoing' is true, only consider the face if we are going out
140 * through the face; otherwise, if false, only consider the face if we are
141 * going in through the face.
142 * @returns true if there is an intersection, false otherwise.
143 */
144 virtual G4bool Intersect (const G4ThreeVector& p, const G4ThreeVector& v,
145 const G4bool outgoing, G4double& distance,
146 G4double& distFromSurface,
147 G4ThreeVector& normal) = 0;
148
149 /**
150 * Auxiliary method for returning the surface area.
151 */
152 virtual G4double GetArea() const = 0;
153
154 /**
155 * Auxiliary method to get a uniform random point on the facet.
156 */
157 virtual G4ThreeVector GetPointOnFace() const = 0;
158
159 /**
160 * Adds a translation 'v' to the vertices of the facet.
161 */
162 void ApplyTranslation (const G4ThreeVector& v);
163
164 /**
165 * Streams the object contents to an output stream.
166 */
167 std::ostream& StreamInfo(std::ostream& os) const;
168
169 /**
170 * Returns true if point 'p' is inside the facet.
171 */
172 G4bool IsInside(const G4ThreeVector& p) const;
173
174 /**
175 * Logger methods for allocated memory of facets.
176 */
177 virtual G4int AllocatedMemory() = 0;
178 virtual void SetVertexIndex (G4int i, G4int j) = 0;
179 virtual G4int GetVertexIndex (G4int i) const = 0;
180
181
182 protected:
183
184 static const G4double dirTolerance;
186};
187
188#endif
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4FacetVertexType
Definition G4VFacet.hh:48
@ ABSOLUTE
Definition G4VFacet.hh:48
@ RELATIVE
Definition G4VFacet.hh:48
G4String G4GeometryType
Definition G4VSolid.hh:70
virtual G4double Distance(const G4ThreeVector &, G4double minDist, const G4bool)=0
void ApplyTranslation(const G4ThreeVector &v)
Definition G4VFacet.cc:85
virtual void SetVertexIndex(G4int i, G4int j)=0
virtual G4double Distance(const G4ThreeVector &, G4double minDist)=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 G4GeometryType GetEntityType() const =0
virtual G4int AllocatedMemory()=0
G4bool operator==(const G4VFacet &right) const
Definition G4VFacet.cc:51
virtual G4ThreeVector GetCircumcentre() const =0
std::ostream & StreamInfo(std::ostream &os) const
Definition G4VFacet.cc:96
static const G4double dirTolerance
Definition G4VFacet.hh:184
G4bool IsInside(const G4ThreeVector &p) const
Definition G4VFacet.cc:114
virtual G4ThreeVector GetSurfaceNormal() const =0
virtual G4ThreeVector GetPointOnFace() const =0
virtual G4ThreeVector GetVertex(G4int i) const =0
virtual G4double GetArea() const =0
virtual G4int GetNumberOfVertices() const =0
virtual G4int GetVertexIndex(G4int i) const =0
virtual G4VFacet * GetClone()=0
virtual G4double GetRadius() const =0
virtual void SetVertex(G4int i, const G4ThreeVector &val)=0
virtual ~G4VFacet()=default
G4double kCarTolerance
Definition G4VFacet.hh:185
virtual void SetVertices(std::vector< G4ThreeVector > *vertices)=0
virtual G4bool IsDefined() const =0
const axis_t axis_to_type< N >::axis
Definition pugixml.cc:9668