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

#include <G4SurfaceBoundary.hh>

Public Member Functions

 G4SurfaceBoundary ()
 
 ~G4SurfaceBoundary ()
 
void Init (const G4CurveVector &bounds0)
 
const G4CurveVectorGetBounds () const
 
const G4BoundingBox3DBBox () const
 
G4SurfaceBoundaryProject (const G4Transform3D &tr=G4Transform3D::Identity)
 
G4int IntersectRay2D (const G4Ray &ray)
 
G4bool Tangent (G4CurvePoint &cp, G4Vector3D &v)
 
void SplitWithPlane (const G4Point3D &p0, const G4Vector3D &n, G4SurfaceBoundary *&new1, G4SurfaceBoundary *&new2)
 
void SplitWithCylinder (const G4CylindricalSurface &c, G4SurfaceBoundary *&new1, G4SurfaceBoundary *&new2)
 
G4int GetNumberOfPoints () const
 
const G4Point3DGetPoint (G4int Count) const
 

Detailed Description

Definition at line 53 of file G4SurfaceBoundary.hh.

Constructor & Destructor Documentation

◆ G4SurfaceBoundary()

G4SurfaceBoundary::G4SurfaceBoundary ( )

Definition at line 41 of file G4SurfaceBoundary.cc.

42{
43}

Referenced by Project().

◆ ~G4SurfaceBoundary()

G4SurfaceBoundary::~G4SurfaceBoundary ( )

Definition at line 45 of file G4SurfaceBoundary.cc.

46{
47}

Member Function Documentation

◆ BBox()

const G4BoundingBox3D & G4SurfaceBoundary::BBox ( ) const
inline

◆ GetBounds()

const G4CurveVector & G4SurfaceBoundary::GetBounds ( ) const
inline

◆ GetNumberOfPoints()

G4int G4SurfaceBoundary::GetNumberOfPoints ( ) const
inline

◆ GetPoint()

const G4Point3D & G4SurfaceBoundary::GetPoint ( G4int  Count) const
inline

◆ Init()

void G4SurfaceBoundary::Init ( const G4CurveVector bounds0)

Definition at line 49 of file G4SurfaceBoundary.cc.

50{
51 bounds= bounds0;
52 lastIntersection.Reset();
53
54 const G4BoundingBox3D* b= bounds[0]->BBox();
55 bBox.Init(b->GetBoxMin(), b->GetBoxMax());
56
57 size_t i;
58 for ( i=1; i<bounds.size(); i++)
59 {
60 b= bounds[i]->BBox();
61 bBox.Extend(b->GetBoxMin());
62 bBox.Extend(b->GetBoxMax());
63 }
64
65 // the points array is probably unused, so the following code is useless
66 G4int cnt= 0;
67
68 size_t entr = bounds.size();
69
70 for (i=0; i < entr; i++)
71 {
72 G4Curve* c = bounds[i];
73
74 if (c->GetEntityType() == "G4CompositeCurve")
75 {
77 const G4CurveVector& segments = cc->GetSegments();
78 cnt+= segments.size();
79 }
80 else
81 cnt++;
82 }
83
84 points.resize(cnt);
85
86 G4int j= 0;
87
88 for (i=0; i<bounds.size(); i++)
89 {
90 G4Curve* c= bounds[i];
91 if (c->GetEntityType() == "G4CompositeCurve")
92 {
94 const G4CurveVector& segments = cc->GetSegments();
95
96 for (size_t k=0; k<segments.size(); k++)
97 {
98 G4Curve* ccc = segments[k];
99 G4Point3D p = ccc->GetEnd();
100 points[j]= p;
101 j++;
102 }
103
104 }
105 else
106 {
107 G4Point3D p= c->GetEnd();
108 points[j]= p;
109 j++;
110 }
111 }
112}
std::vector< G4Curve * > G4CurveVector
int G4int
Definition: G4Types.hh:66
void Init(const G4Point3D &)
G4Point3D GetBoxMin() const
void Extend(const G4Point3D &)
G4Point3D GetBoxMax() const
const G4CurveVector & GetSegments() const
virtual G4String GetEntityType() const
Definition: G4Curve.cc:72
const G4Point3D & GetEnd() const

Referenced by Project(), and G4Surface::SetBoundaries().

◆ IntersectRay2D()

G4int G4SurfaceBoundary::IntersectRay2D ( const G4Ray ray)

Definition at line 179 of file G4SurfaceBoundary.cc.

180{
181 G4int nbinter = 0;
182 G4int temp = 0;
183
184 for (size_t i=0; i < bounds.size(); i++)
185 {
186 G4Curve& c = *bounds[i];
187 temp = c.IntersectRay2D(ray);
188
189 // test if the point is on the boundary
190 if ( temp == 999 )
191 nbinter = 1;
192 else
193 nbinter += temp;
194 }
195
196 return nbinter;
197}
virtual G4int IntersectRay2D(const G4Ray &ray)=0

Referenced by G4FPlane::Intersect().

◆ Project()

G4SurfaceBoundary * G4SurfaceBoundary::Project ( const G4Transform3D tr = G4Transform3D::Identity)

Definition at line 115 of file G4SurfaceBoundary.cc.

116{
117 G4CurveVector newBounds;
118 G4Curve* a = 0;
119 G4Curve* c = 0;
120
121 for (size_t i=0; i<bounds.size(); i++)
122 {
123 c= bounds[i]->Project(tr);
124
125 if (c==0)
126 {
127 // Remove newBounds and delete all its contents
128 while (newBounds.size()>0)
129 {
130 a = newBounds.back();
131 newBounds.pop_back();
132 for (G4CurveVector::iterator it=newBounds.begin();
133 it!=newBounds.end();)
134 {
135 if (*it==a)
136 {
137 it = newBounds.erase(it);
138 }
139 else
140 {
141 it--;
142 }
143 }
144 if ( a ) { delete a; }
145 }
146 return 0;
147 }
148 // L. Broglia
149 c->SetSameSense( bounds[i]->GetSameSense() );
150
151 newBounds.push_back(c);
152 }
153
155 lof->Init(newBounds);
156 return lof;
157}
void SetSameSense(G4int sameSense0)
void Init(const G4CurveVector &bounds0)

Referenced by G4FPlane::InitBounded().

◆ SplitWithCylinder()

void G4SurfaceBoundary::SplitWithCylinder ( const G4CylindricalSurface c,
G4SurfaceBoundary *&  new1,
G4SurfaceBoundary *&  new2 
)

Definition at line 221 of file G4SurfaceBoundary.cc.

224{
225 G4Exception("G4SurfaceBoundary::SplitWithCylinder()", "GeomSolids0001",
226 FatalException, "Sorry, not yet implemented.");
227}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ SplitWithPlane()

void G4SurfaceBoundary::SplitWithPlane ( const G4Point3D p0,
const G4Vector3D n,
G4SurfaceBoundary *&  new1,
G4SurfaceBoundary *&  new2 
)

Definition at line 212 of file G4SurfaceBoundary.cc.

216{
217 G4Exception("G4SurfaceBoundary::SplitWithPlane()", "GeomSolids0001",
218 FatalException, "Sorry, not yet implemented.");
219}

◆ Tangent()

G4bool G4SurfaceBoundary::Tangent ( G4CurvePoint cp,
G4Vector3D v 
)

Definition at line 200 of file G4SurfaceBoundary.cc.

201{
202 if (lastIntersection.GetDistance() == kInfinity)
203 return false;
204
205 return lastIntersection.GetCurve().Tangent(lastIntersection, v);
206 // should be true
207
208 // cp is ignored for the moment
209}
G4Curve & GetCurve() const
virtual G4bool Tangent(G4CurvePoint &cp, G4Vector3D &v)=0

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