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

#include <G4CompositeCurve.hh>

+ Inheritance diagram for G4CompositeCurve:

Public Member Functions

 G4CompositeCurve ()
 
virtual ~G4CompositeCurve ()
 
 G4CompositeCurve (const G4Point3DVector &vertices)
 
virtual G4String GetEntityType () const
 
virtual G4CurveProject (const G4Transform3D &tr=G4Transform3D::Identity)
 
virtual G4bool Tangent (G4CurvePoint &cp, G4Vector3D &v)
 
virtual G4double GetPMax () const
 
virtual G4Point3D GetPoint (G4double param) const
 
virtual G4double GetPPoint (const G4Point3D &p) const
 
const G4CurveVectorGetSegments () const
 
void Init (const G4CurveVector &segments0)
 
virtual G4int IntersectRay2D (const G4Ray &ray)
 
- Public Member Functions inherited from G4Curve
 G4Curve ()
 
virtual ~G4Curve ()
 
 G4Curve (const G4Curve &c)
 
G4Curveoperator= (const G4Curve &c)
 
G4bool operator== (const G4Curve &right) const
 
virtual G4String GetEntityType () const
 
virtual G4CurveProject (const G4Transform3D &tr=G4Transform3D::Identity)=0
 
virtual G4bool Tangent (G4CurvePoint &cp, G4Vector3D &v)=0
 
virtual G4int IntersectRay2D (const G4Ray &ray)=0
 
const G4Point3DGetStart () const
 
const G4Point3DGetEnd () const
 
G4double GetPStart () const
 
G4double GetPEnd () const
 
void SetBounds (G4double p1, G4double p2)
 
void SetBounds (G4double p1, const G4Point3D &p2)
 
void SetBounds (const G4Point3D &p1, G4double p2)
 
void SetBounds (const G4Point3D &p1, const G4Point3D &p2)
 
G4bool IsBounded () const
 
G4bool IsPOn (G4double param) const
 
void SetSameSense (G4int sameSense0)
 
G4int GetSameSense () const
 
virtual G4double GetPMax () const =0
 
virtual G4Point3D GetPoint (G4double param) const =0
 
virtual G4double GetPPoint (const G4Point3D &p) const =0
 
const G4BoundingBox3DBBox () const
 
virtual const char * Name () const
 
virtual void SetParentSrfPtr (const G4Surface *)
 

Protected Member Functions

virtual void InitBounded ()
 
virtual void InitBounded ()=0
 

Additional Inherited Members

- Protected Attributes inherited from G4Curve
G4BoundingBox3D bBox
 
G4Point3D start
 
G4Point3D end
 
G4double pStart
 
G4double pEnd
 
G4double pRange
 
G4bool bounded
 
G4int sameSense
 
G4double kCarTolerance
 

Detailed Description

Definition at line 48 of file G4CompositeCurve.hh.

Constructor & Destructor Documentation

◆ G4CompositeCurve() [1/2]

G4CompositeCurve::G4CompositeCurve ( )

Definition at line 40 of file G4CompositeCurve.cc.

40{}

Referenced by Project().

◆ ~G4CompositeCurve()

G4CompositeCurve::~G4CompositeCurve ( )
virtual

Definition at line 59 of file G4CompositeCurve.cc.

60{
61 // Remove segments and delete all its contents
62
63 G4Curve* a = 0;
64 while (segments.size()>0)
65 {
66 a = segments.back();
67 segments.pop_back();
68 for (G4CurveVector::iterator i=segments.begin(); i!=segments.end();)
69 {
70 if (*i==a)
71 {
72 i = segments.erase(i);
73 }
74 else
75 {
76 ++i;
77 }
78 }
79 delete a;
80 }
81}

◆ G4CompositeCurve() [2/2]

G4CompositeCurve::G4CompositeCurve ( const G4Point3DVector vertices)

Definition at line 42 of file G4CompositeCurve.cc.

43{
45 for (size_t i=0; i<vertices.size(); i++)
46 {
47 G4Point3D p1= vertices[i];
48 G4Point3D p2= vertices[(i+1) % vertices.size()];
49
50 G4Line* l= new G4Line;
51 l->Init(p1, p2-p1);
52 l->SetBounds(p1, p2);
53 cv.push_back(l);
54 }
55
56 Init(cv);
57}
std::vector< G4Curve * > G4CurveVector
void Init(const G4CurveVector &segments0)
void SetBounds(G4double p1, G4double p2)
Definition: G4Line.hh:45
void Init(const G4Point3D &pnt0, const G4Vector3D &dir0)

Member Function Documentation

◆ GetEntityType()

G4String G4CompositeCurve::GetEntityType ( ) const
virtual

Reimplemented from G4Curve.

Definition at line 83 of file G4CompositeCurve.cc.

84{
85 return G4String("G4CompositeCurve");
86}

◆ GetPMax()

G4double G4CompositeCurve::GetPMax ( ) const
virtual

Implements G4Curve.

Definition at line 130 of file G4CompositeCurve.cc.

131{
132 G4Exception("G4CompositeCurve::GetPMax()", "GeomSolids0002",
133 FatalException, "Not applicable to base class.");
134 return 0;
135}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ GetPoint()

G4Point3D G4CompositeCurve::GetPoint ( G4double  param) const
virtual

Implements G4Curve.

Definition at line 137 of file G4CompositeCurve.cc.

138{
139 G4Exception("G4CompositeCurve::GetPoint()", "GeomSolids0002",
140 FatalException, "Not applicable to base class.");
141 // Fake return value
142 return G4Point3D();
143}
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35

◆ GetPPoint()

G4double G4CompositeCurve::GetPPoint ( const G4Point3D p) const
virtual

Implements G4Curve.

Definition at line 145 of file G4CompositeCurve.cc.

146{
147 G4Exception("G4CompositeCurve::GetPPoint()", "GeomSolids0002",
148 FatalException, "Not applicable to base class.");
149 return 0;
150}

◆ GetSegments()

const G4CurveVector & G4CompositeCurve::GetSegments ( ) const

◆ Init()

void G4CompositeCurve::Init ( const G4CurveVector segments0)

Referenced by G4CompositeCurve(), and Project().

◆ InitBounded()

void G4CompositeCurve::InitBounded ( )
protectedvirtual

Implements G4Curve.

Definition at line 204 of file G4CompositeCurve.cc.

205{
206 const G4BoundingBox3D* b= segments[0]->BBox();
207 bBox.Init(b->GetBoxMin(), b->GetBoxMax());
208
209 for (size_t i=1; i<segments.size(); i++)
210 {
211 b= segments[i]->BBox();
212 bBox.Extend(b->GetBoxMin());
213 bBox.Extend(b->GetBoxMax());
214 }
215
216 // init for efficient parameter <-> 3D point conversions
217}
void Init(const G4Point3D &)
G4Point3D GetBoxMin() const
void Extend(const G4Point3D &)
G4Point3D GetBoxMax() const
G4BoundingBox3D bBox
Definition: G4Curve.hh:160

◆ IntersectRay2D()

G4int G4CompositeCurve::IntersectRay2D ( const G4Ray ray)
virtual

Implements G4Curve.

Definition at line 173 of file G4CompositeCurve.cc.

174{
175 G4int nbinter = 0;
176 G4int temp = 0;
177
178 for (size_t i=0; i<segments.size(); i++)
179 {
180 G4Curve& c= *(segments[i]);
181 temp = c.IntersectRay2D(ray);
182
183 // test if the point is on the composite curve
184 if( temp == 999 )
185 return 999;
186 else
187 nbinter+= temp;
188 }
189
190 return nbinter;
191}
int G4int
Definition: G4Types.hh:66
virtual G4int IntersectRay2D(const G4Ray &ray)=0

◆ Project()

G4Curve * G4CompositeCurve::Project ( const G4Transform3D tr = G4Transform3D::Identity)
virtual

Implements G4Curve.

Definition at line 88 of file G4CompositeCurve.cc.

89{
90 G4CurveVector newSegments;
91 G4Curve* a = 0;
92 G4Curve* c = 0;
93
94 for (size_t i=0; i<segments.size(); i++)
95 {
96 c = segments[i]->Project(tr);
97 if (c==0)
98 {
99 // Remove newSegments and delete all its contents
100 while (newSegments.size()>0)
101 {
102 a = newSegments.back();
103 newSegments.pop_back();
104 for (G4CurveVector::iterator it=newSegments.begin();
105 it!=newSegments.end();)
106 {
107 if (*it==a)
108 {
109 it = newSegments.erase(it);
110 }
111 else
112 {
113 ++it;
114 }
115 }
116 delete a;
117 }
118 return 0;
119 }
120 newSegments.push_back(c);
121 }
122
124 r->Init(newSegments);
125 return r;
126}

◆ Tangent()

G4bool G4CompositeCurve::Tangent ( G4CurvePoint cp,
G4Vector3D v 
)
virtual

Implements G4Curve.

Definition at line 193 of file G4CompositeCurve.cc.

194{
195 if (lastIntersection.GetDistance() == kInfinity)
196 return false;
197
198 return lastIntersection.GetCurve().Tangent(lastIntersection, v);
199 // should be true
200 // cp is ignored for the moment
201}
G4Curve & GetCurve() const
virtual G4bool Tangent(G4CurvePoint &cp, G4Vector3D &v)=0

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