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

#include <G4Surface.hh>

+ Inheritance diagram for G4Surface:

Public Member Functions

 G4Surface ()
 
virtual ~G4Surface ()
 
G4int operator== (const G4Surface &s)
 
virtual G4String GetEntityType () const
 
virtual const char * Name () const
 
virtual G4int MyType () const
 
void SetBoundaries (G4CurveVector *)
 
virtual G4double HowNear (const G4Vector3D &x) const
 
virtual G4double ClosestDistanceToPoint (const G4Point3D &Pt)
 
G4Vector3D GetOrigin () const
 
G4double GetDistance () const
 
void SetDistance (G4double Dist)
 
G4int IsActive () const
 
void SetActive (G4int act)
 
void Deactivate ()
 
void SetSameSense (G4int sameSense0)
 
G4int GetSameSense () const
 
G4BoundingBox3DGetBBox ()
 
const G4Point3DGetClosestHit () const
 
void SetNextNode (G4Surface *)
 
G4SurfaceGetNextNode ()
 
virtual void Reset ()
 
virtual G4int Intersect (const G4Ray &)
 
virtual G4Vector3D Normal (const G4Vector3D &p) const
 
virtual void CalcBBox ()
 
virtual G4double GetUHit () const
 
virtual G4double GetVHit () const
 
virtual G4Point3D Evaluation (const G4Ray &G4Rayref)
 
virtual G4int Evaluate (register const G4Ray &Rayref)
 
virtual void Project ()
 
virtual void CalcNormal ()
 
virtual G4int IsConvex () const
 
virtual G4int GetConvex () const
 
virtual G4int GetNumberOfPoints () const
 
virtual const G4Point3DGetPoint (G4int Count) const
 
virtual G4RayNorm ()
 
virtual G4Vector3D SurfaceNormal (const G4Point3D &Pt) const =0
 
- Public Member Functions inherited from G4STEPEntity
 G4STEPEntity ()
 
virtual ~G4STEPEntity ()
 
virtual G4String GetEntityType () const =0
 

Static Public Member Functions

static void Project (G4double &Coord, const G4Point3D &Pt, const G4Plane &Pl)
 

Protected Member Functions

virtual void InitBounded ()
 

Protected Attributes

G4BoundingBox3Dbbox
 
G4Point3D closest_hit
 
G4Surfacenext
 
G4SurfaceBoundary surfaceBoundary
 
G4double kCarTolerance
 
G4double kAngTolerance
 
G4int Intersected
 
G4Vector3D origin
 
G4int Type
 
G4int AdvancedFace
 
G4int active
 
G4double distance
 
G4double uhit
 
G4double vhit
 
G4int sameSense
 

Detailed Description

Definition at line 50 of file G4Surface.hh.

Constructor & Destructor Documentation

◆ G4Surface()

G4Surface::G4Surface ( )

Definition at line 40 of file G4Surface.cc.

41 : G4STEPEntity(),
42 bbox(0), next(0), Intersected(0), Type(0), AdvancedFace(0),
43 active(1), distance(kInfinity), uhit(0.), vhit(0.), sameSense(0)
44{
47}
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4double GetAngularTolerance() const
G4double kAngTolerance
Definition: G4Surface.hh:192
G4int sameSense
Definition: G4Surface.hh:207
G4double uhit
Definition: G4Surface.hh:204
G4double vhit
Definition: G4Surface.hh:204
G4int Type
Definition: G4Surface.hh:200
G4double distance
Definition: G4Surface.hh:203
G4BoundingBox3D * bbox
Definition: G4Surface.hh:185
G4int Intersected
Definition: G4Surface.hh:194
G4int active
Definition: G4Surface.hh:202
G4int AdvancedFace
Definition: G4Surface.hh:201
G4double kCarTolerance
Definition: G4Surface.hh:192
G4Surface * next
Definition: G4Surface.hh:187

◆ ~G4Surface()

G4Surface::~G4Surface ( )
virtual

Definition at line 50 of file G4Surface.cc.

51{
52}

Member Function Documentation

◆ CalcBBox()

void G4Surface::CalcBBox ( )
virtual

Reimplemented in G4BezierSurface, G4BSplineSurface, G4ConicalSurface, G4FConicalSurface, G4FCylindricalSurface, G4FPlane, G4ProjectedSurface, G4RectangularTrimmedSurface, G4SphericalSurface, and G4ToroidalSurface.

Definition at line 146 of file G4Surface.cc.

147{
148 // Finds the bounds of the surface iow
149 // calculates the bounds for a bounding box
150 // to the surface. The bounding box is used
151 // for a preliminary check of intersection.
152
155 // old implementation
156 // G4Point3d BoundaryMax = OuterBoundary->GetBoundsMax();
157 // G4Point3d BoundaryMin = OuterBoundary->GetBoundsMin();
158 // bbox = new G4BoundingBox( BoundaryMin, BoundaryMax);
159 // return;
160}
G4Point3D GetBoxMin() const
G4Point3D GetBoxMax() const
const G4BoundingBox3D & BBox() const
G4SurfaceBoundary surfaceBoundary
Definition: G4Surface.hh:189

Referenced by G4RectangularTrimmedSurface::CalcBBox(), and G4BREPSolid::CalcBBoxes().

◆ CalcNormal()

void G4Surface::CalcNormal ( )
virtual

Reimplemented in G4FPlane.

Definition at line 295 of file G4Surface.cc.

296{
297}

◆ ClosestDistanceToPoint()

G4double G4Surface::ClosestDistanceToPoint ( const G4Point3D Pt)
virtual

Reimplemented in G4BSplineSurface, G4FPlane, and G4ToroidalSurface.

Definition at line 203 of file G4Surface.cc.

204{
205 // in fact, a squared distance is returned
206
207 // a bit suspicious, this function
208 // the distance is almost always an overestimate
209 G4double pointDistance= kInfinity;
210 G4double tmpDistance;
211 const G4CurveVector& bounds= surfaceBoundary.GetBounds();
212
213 G4int entr = bounds.size();
214
215 for (G4int i=0; i<entr; i++)
216 {
217 G4Curve* c= bounds[i];
218
219 if (c->GetEntityType() == "G4CompositeCurve")
220 {
222 const G4CurveVector& segments= cc->GetSegments();
223 for (size_t j=0; j<segments.size(); j++)
224 {
225 G4Curve* ccc= segments[j];
226 tmpDistance= (G4Point3D(Pt.x(), Pt.y(), Pt.z())-ccc->GetEnd()).mag2();
227 if (pointDistance > tmpDistance)
228 {
229 pointDistance= tmpDistance;
230 }
231 }
232
233 }
234 else
235 {
236 tmpDistance= (G4Point3D(Pt.x(), Pt.y(), Pt.z())-c->GetEnd()).mag2();
237 if (pointDistance > tmpDistance)
238 {
239 pointDistance= tmpDistance;
240 }
241 }
242 }
243
244 // L. Broglia
245 // Be carreful ! pointdistance is the squared distance
246 return std::sqrt(pointDistance);
247
248 // G4double PointDistance=kInfinity;
249 // G4double TmpDistance=0;
250 // PointDistance = OuterBoundary->ClosestDistanceToPoint(Pt);
251 // TmpDistance =0;
252 // for(G4int a=0;a<NumberOfInnerBoundaries;a++)
253 // {
254 // TmpDistance = InnerBoundary[a]->ClosestDistanceToPoint(Pt);
255 // if(PointDistance > TmpDistance) PointDistance = TmpDistance;
256 // }
257 // return PointDistance;
258
259 //G4double G4Boundary::ClosestDistanceToPoint(const G4ThreeVec& Pt)
260 //{
261 // G4double PointDistance = kInfinity;
262 // G4double TmpDistance = 0;
263 // for(G4int a =0; a < NumberOfPoints;a++)
264 // {
265 // G4Point3d& Pt2 = GetPoint(a);
266 // TmpDistance = Pt2.Distance(Pt);
267 // if(PointDistance > TmpDistance)PointDistance = TmpDistance;
268 // }
269 // return PointDistance;
270 //}
271}
std::vector< G4Curve * > G4CurveVector
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
const G4CurveVector & GetSegments() const
virtual G4String GetEntityType() const
Definition: G4Curve.cc:72
const G4Point3D & GetEnd() const
const G4CurveVector & GetBounds() const

Referenced by G4BREPSolidCone::Inside().

◆ Deactivate()

void G4Surface::Deactivate ( )
inline

◆ Evaluate()

G4int G4Surface::Evaluate ( register const G4Ray Rayref)
virtual

Definition at line 128 of file G4Surface.cc.

129{
130 return 0;
131}

◆ Evaluation()

G4Point3D G4Surface::Evaluation ( const G4Ray G4Rayref)
virtual

Definition at line 123 of file G4Surface.cc.

124{
125 return closest_hit;
126}
G4Point3D closest_hit
Definition: G4Surface.hh:186

◆ GetBBox()

◆ GetClosestHit()

◆ GetConvex()

G4int G4Surface::GetConvex ( ) const
virtual

Reimplemented in G4FPlane.

Definition at line 304 of file G4Surface.cc.

305{
306 return 0;
307}

◆ GetDistance()

◆ GetEntityType()

G4String G4Surface::GetEntityType ( ) const
virtual

Implements G4STEPEntity.

Reimplemented in G4ConicalSurface, G4CylindricalSurface, G4FConicalSurface, G4FCylindricalSurface, G4SphericalSurface, and G4ToroidalSurface.

Definition at line 92 of file G4Surface.cc.

93{
94 return G4String("Surface");
95}

◆ GetNextNode()

◆ GetNumberOfPoints()

G4int G4Surface::GetNumberOfPoints ( ) const
virtual

Reimplemented in G4FPlane.

Definition at line 309 of file G4Surface.cc.

310{
311 return 0;
312}

Referenced by G4BREPSolid::CheckSurfaceNormals(), and G4BREPSolid::IsConvex().

◆ GetOrigin()

◆ GetPoint()

const G4Point3D & G4Surface::GetPoint ( G4int  Count) const
virtual

Reimplemented in G4FPlane.

Definition at line 314 of file G4Surface.cc.

315{
316 const G4Point3D* tmp= new G4Point3D(0,0,0);
317 return *tmp;
318}

Referenced by G4BREPSolid::CheckSurfaceNormals(), and G4BREPSolid::IsConvex().

◆ GetSameSense()

G4int G4Surface::GetSameSense ( ) const
inline

Referenced by G4FPlane::CalcNormal().

◆ GetUHit()

G4double G4Surface::GetUHit ( ) const
virtual

Reimplemented in G4BSplineSurface.

Definition at line 111 of file G4Surface.cc.

112{
113 return uhit;
114}

Referenced by G4RectangularTrimmedSurface::Intersect().

◆ GetVHit()

G4double G4Surface::GetVHit ( ) const
virtual

Reimplemented in G4BSplineSurface.

Definition at line 116 of file G4Surface.cc.

117{
118 return vhit;
119}

Referenced by G4RectangularTrimmedSurface::Intersect().

◆ HowNear()

G4double G4Surface::HowNear ( const G4Vector3D x) const
virtual

Reimplemented in G4ConicalSurface, G4CylindricalSurface, G4FConicalSurface, G4FCylindricalSurface, G4FPlane, and G4SphericalSurface.

Definition at line 283 of file G4Surface.cc.

284{
285 // Distance from the point x to a Surface.
286 // The default for a Surface is the distance from the point to the origin.
287 G4Vector3D p = G4Vector3D( x - origin );
288 return p.mag();
289}
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:35
G4Vector3D origin
Definition: G4Surface.hh:197

Referenced by G4BREPSolidPCone::DistanceToIn(), G4BREPSolidPolyhedra::DistanceToOut(), G4BREPSolidPCone::DistanceToOut(), G4BREPSolidCone::Inside(), G4BREPSolidPCone::Inside(), and G4BREPSolidSphere::Inside().

◆ InitBounded()

void G4Surface::InitBounded ( )
protectedvirtual

Reimplemented in G4FPlane.

Definition at line 107 of file G4Surface.cc.

108{
109}

Referenced by SetBoundaries().

◆ Intersect()

G4int G4Surface::Intersect ( const G4Ray )
virtual

Reimplemented in G4BSplineSurface, G4FCylindricalSurface, G4RectangularTrimmedSurface, G4SphericalSurface, G4ToroidalSurface, G4FPlane, G4ConicalSurface, G4CylindricalSurface, and G4FConicalSurface.

Definition at line 170 of file G4Surface.cc.

171{
172 G4int Result = 0;
173
174 G4Exception("G4Surface::Intersect()", "GeomSolids0001",
175 FatalException, "Sorry, not yet implemented.");
176
177#ifdef NEW_IMPLEMENTATION
178 // get the intersection
179 // Result = Intersect(rayref);
180
181 // Check that the point is within the polyline
182 // Get Normal at Hitpoint
183 const G4Vector3D& Vec = Normal(closest_hit);
185
186 // Project points & Hit
187 // OuterBoundary->ProjectBoundaryTo2D(Normal.GetPlane(1),
188 // Normal.GetPlane(2), 0);
189
190
191
192
193 G4Point3D Hit = closest_hit.Project(Normal.GetPlane(1),
194 Normal.GetPlane(2) );
195 // Check point in polygon
196 // Result = OuterBoundary->Inside(Hit, rayref);
197
198#endif
199 return Result;
200}
@ FatalException
Definition: G4Ray.hh:49
virtual G4Vector3D Normal(const G4Vector3D &p) const
Definition: G4Surface.cc:162
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by G4BREPSolidSphere::DistanceToIn(), G4BREPSolidPolyhedra::DistanceToOut(), G4BREPSolidPCone::Inside(), G4BREPSolidPolyhedra::Inside(), G4RectangularTrimmedSurface::Intersect(), G4BREPSolid::Intersect(), and G4BREPSolid::TestSurfaceBBoxes().

◆ IsActive()

◆ IsConvex()

G4int G4Surface::IsConvex ( ) const
virtual

Reimplemented in G4FPlane.

Definition at line 299 of file G4Surface.cc.

300{
301 return -1;
302}

Referenced by G4BREPSolid::IsConvex().

◆ MyType()

G4int G4Surface::MyType ( ) const
virtual

Reimplemented in G4BSplineSurface, and G4FPlane.

Definition at line 102 of file G4Surface.cc.

103{
104 return Type;
105}

Referenced by G4BREPSolid::Intersect(), G4BREPSolid::RemoveHiddenFaces(), and G4BREPSolid::TestSurfaceBBoxes().

◆ Name()

const char * G4Surface::Name ( ) const
virtual

Reimplemented in G4FConicalSurface, G4FPlane, and G4RectangularTrimmedSurface.

Definition at line 97 of file G4Surface.cc.

98{
99 return "G4Surface";
100}

◆ Norm()

G4Ray * G4Surface::Norm ( )
virtual

Reimplemented in G4FPlane.

Definition at line 320 of file G4Surface.cc.

321{
322 return (G4Ray*)0;
323}

Referenced by G4BREPSolid::CheckSurfaceNormals(), G4BREPSolid::IsConvex(), and G4BREPSolid::RemoveHiddenFaces().

◆ Normal()

G4Vector3D G4Surface::Normal ( const G4Vector3D p) const
virtual

Reimplemented in G4CylindricalSurface, and G4SphericalSurface.

Definition at line 162 of file G4Surface.cc.

163{ // return the Normal unit vector to a Surface at the point p on
164 // (or nearly on) the Surface.
165 // The default is not well defined, so return ( 0, 0, 0 ).
166 return G4Vector3D( 0.0, 0.0, 0.0 );
167}

Referenced by Intersect(), G4BREPSolidSphere::SurfaceNormal(), and G4BREPSolidCone::SurfaceNormal().

◆ operator==()

G4int G4Surface::operator== ( const G4Surface s)

Definition at line 87 of file G4Surface.cc.

88{
89 return origin == surf.origin;
90}

◆ Project() [1/2]

void G4Surface::Project ( )
virtual

Reimplemented in G4FPlane.

Definition at line 291 of file G4Surface.cc.

292{
293}

◆ Project() [2/2]

void G4Surface::Project ( G4double Coord,
const G4Point3D Pt,
const G4Plane Pl 
)
static

Definition at line 325 of file G4Surface.cc.

328{
329 Coord = Pt2.x()*Pl1.a + Pt2.y()*Pl1.b + Pt2.z()*Pl1.c - Pl1.d;
330}

◆ Reset()

void G4Surface::Reset ( )
virtual

Reimplemented in G4BSplineSurface.

Definition at line 133 of file G4Surface.cc.

134{
135 Intersected = 0;
136 active = 1;
137 distance = kInfinity;
138}

◆ SetActive()

void G4Surface::SetActive ( G4int  act)
inline

◆ SetBoundaries()

void G4Surface::SetBoundaries ( G4CurveVector boundaries)

Definition at line 140 of file G4Surface.cc.

141{
142 surfaceBoundary.Init(*boundaries);
143 InitBounded();
144}
void Init(const G4CurveVector &bounds0)
virtual void InitBounded()
Definition: G4Surface.cc:107

Referenced by G4FPlane::G4FPlane().

◆ SetDistance()

void G4Surface::SetDistance ( G4double  Dist)
inline

◆ SetNextNode()

◆ SetSameSense()

void G4Surface::SetSameSense ( G4int  sameSense0)
inline

Referenced by G4FPlane::G4FPlane().

◆ SurfaceNormal()

Member Data Documentation

◆ active

G4int G4Surface::active
protected

◆ AdvancedFace

G4int G4Surface::AdvancedFace
protected

Definition at line 201 of file G4Surface.hh.

◆ bbox

◆ closest_hit

◆ distance

◆ Intersected

G4int G4Surface::Intersected
protected

Definition at line 194 of file G4Surface.hh.

Referenced by G4BSplineSurface::Intersect(), G4FPlane::Intersect(), and Reset().

◆ kAngTolerance

G4double G4Surface::kAngTolerance
protected

Definition at line 192 of file G4Surface.hh.

Referenced by G4Surface(), and G4SphericalSurface::resize().

◆ kCarTolerance

◆ next

G4Surface* G4Surface::next
protected

Definition at line 187 of file G4Surface.hh.

◆ origin

◆ sameSense

G4int G4Surface::sameSense
protected

◆ surfaceBoundary

◆ Type

G4int G4Surface::Type
protected

Definition at line 200 of file G4Surface.hh.

Referenced by G4FPlane::G4FPlane(), and MyType().

◆ uhit

G4double G4Surface::uhit
protected

Definition at line 204 of file G4Surface.hh.

Referenced by GetUHit().

◆ vhit

G4double G4Surface::vhit
protected

Definition at line 204 of file G4Surface.hh.

Referenced by GetVHit().


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