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

#include <G4BSplineSurface.hh>

+ Inheritance diagram for G4BSplineSurface:

Public Member Functions

 G4BSplineSurface ()
 
 G4BSplineSurface (const char *nurbfilename, G4Ray &rayref)
 
 G4BSplineSurface (G4int u, G4int v, G4KnotVector &u_kv, G4KnotVector &v_kv, G4ControlPoints &cp)
 
virtual ~G4BSplineSurface ()
 
G4int Intersect (const G4Ray &)
 
void CalcBBox ()
 
G4double GetUHit () const
 
G4double GetVHit () const
 
G4double ClosestDistanceToPoint (const G4Point3D &)
 
void Reset ()
 
G4int GetRows () const
 
G4int GetCols () const
 
G4Point3D GetControlPoint (G4int a, G4int b) const
 
G4int MyType () const
 
- Public Member Functions inherited from G4Surface
 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
 

Additional Inherited Members

- Static Public Member Functions inherited from G4Surface
static void Project (G4double &Coord, const G4Point3D &Pt, const G4Plane &Pl)
 
- Protected Member Functions inherited from G4Surface
virtual void InitBounded ()
 
- Protected Attributes inherited from G4Surface
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 48 of file G4BSplineSurface.hh.

Constructor & Destructor Documentation

◆ G4BSplineSurface() [1/3]

G4BSplineSurface::G4BSplineSurface ( )

Definition at line 41 of file G4BSplineSurface.cc.

42 : ord(0), k_index(0), param(0.), Rational(0)
43{
44 distance = kInfinity;
45 dir=ROW;
46 first_hit = Hit = (G4UVHit*)0;
47 order[0] = 0; order[1] = 0;
48 ctl_points = (G4ControlPoints*)0;
49 u_knots = v_knots = tmp_knots = (G4KnotVector*)0;
50}
#define ROW
Definition: G4PointRat.hh:51
G4double distance
Definition: G4Surface.hh:203

◆ G4BSplineSurface() [2/3]

G4BSplineSurface::G4BSplineSurface ( const char *  nurbfilename,
G4Ray rayref 
)

Definition at line 53 of file G4BSplineSurface.cc.

54 : dir(0), ord(0), k_index(0), param(0.), Rational(0)
55{
56 distance = kInfinity;
57 first_hit = Hit = (G4UVHit*)0;
58 order[0] = 0; order[1] = 0;
59 ctl_points = (G4ControlPoints*)0;
60 u_knots = v_knots = tmp_knots = (G4KnotVector*)0;
61}

◆ G4BSplineSurface() [3/3]

G4BSplineSurface::G4BSplineSurface ( G4int  u,
G4int  v,
G4KnotVector u_kv,
G4KnotVector v_kv,
G4ControlPoints cp 
)

Definition at line 64 of file G4BSplineSurface.cc.

66 : dir(0), ord(0), k_index(0), param(0.), Rational(0)
67{
68 first_hit = Hit = (G4UVHit*)0;
69
70 order[0] = u+1; order[1] = v+1;
71
72 u_knots = new G4KnotVector(u_kv);
73 v_knots = new G4KnotVector(v_kv);
74 tmp_knots = (G4KnotVector*)0;
75
76 ctl_points = new G4ControlPoints(cp);
77}

◆ ~G4BSplineSurface()

G4BSplineSurface::~G4BSplineSurface ( )
virtual

Definition at line 80 of file G4BSplineSurface.cc.

81{
82 delete u_knots;
83 delete v_knots;
84 delete ctl_points;
85 G4UVHit* temphit=Hit;
86 Hit = first_hit;
87 while(Hit!=(G4UVHit*)0)
88 {
89 Hit=Hit->GetNext();
90 delete temphit;
91 temphit=Hit;
92 }
93 // delete temphit;// remove last
94
95}
G4UVHit * GetNext()
Definition: G4UVHit.hh:52

Member Function Documentation

◆ CalcBBox()

void G4BSplineSurface::CalcBBox ( )
virtual

Reimplemented from G4Surface.

Definition at line 260 of file G4BSplineSurface.cc.

261{
262
263 // Finds the bounds of the b-spline surface iow
264 // calculates the bounds for a bounding box
265 // to the surface. The bounding box is used
266 // for a preliminary check of intersection.
267
268 G4Point3D box_min = G4Point3D( PINFINITY);
269 G4Point3D box_max = G4Point3D(-PINFINITY);
270
271 // Loop to search the whole control point mesh
272 // for the minimum and maximum values for x, y and z.
273
274 for(register int a = ctl_points->GetRows()-1; a>=0;a--)
275 for(register int b = ctl_points->GetCols()-1; b>=0;b--)
276 {
277 G4Point3D tmp = ctl_points->Get3D(a,b);
278 if((box_min.x()) > (tmp.x())) box_min.setX(tmp.x());
279 if((box_min.y()) > (tmp.y())) box_min.setY(tmp.y());
280 if((box_min.z()) > (tmp.z())) box_min.setZ(tmp.z());
281 if((box_max.x()) < (tmp.x())) box_max.setX(tmp.x());
282 if((box_max.y()) < (tmp.y())) box_max.setY(tmp.y());
283 if((box_max.z()) < (tmp.z())) box_max.setZ(tmp.z());
284 }
285 bbox = new G4BoundingBox3D( box_min, box_max);
286}
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
const G4Point3D PINFINITY(kInfinity, kInfinity, kInfinity)
G4int GetCols() const
G4int GetRows() const
G4Point3D Get3D(G4int i, G4int j) const
G4BoundingBox3D * bbox
Definition: G4Surface.hh:185

◆ ClosestDistanceToPoint()

G4double G4BSplineSurface::ClosestDistanceToPoint ( const G4Point3D Pt)
virtual

Reimplemented from G4Surface.

Definition at line 641 of file G4BSplineSurface.cc.

642{
643 G4double PointDistance=0;
644 PointDistance = ctl_points->ClosestDistanceToPoint(Pt);
645 return PointDistance;
646}
double G4double
Definition: G4Types.hh:64
G4double ClosestDistanceToPoint(const G4Point3D &)

◆ GetCols()

G4int G4BSplineSurface::GetCols ( ) const
inline

◆ GetControlPoint()

G4Point3D G4BSplineSurface::GetControlPoint ( G4int  a,
G4int  b 
) const
inline

◆ GetRows()

G4int G4BSplineSurface::GetRows ( ) const
inline

◆ GetUHit()

G4double G4BSplineSurface::GetUHit ( ) const
inlinevirtual

Reimplemented from G4Surface.

◆ GetVHit()

G4double G4BSplineSurface::GetVHit ( ) const
inlinevirtual

Reimplemented from G4Surface.

◆ Intersect()

G4int G4BSplineSurface::Intersect ( const G4Ray rayref)
virtual

Reimplemented from G4Surface.

Definition at line 98 of file G4BSplineSurface.cc.

99{
100 Intersected = 1;
101 FindIntersections(rayref);
102 G4BezierSurface *bez_ptr;
103 bezier_list.MoveToFirst();
104 distance = kInfinity;
105
106 while( bezier_list.GetSurface() != (G4Surface*)0)
107 {
108 bez_ptr = (G4BezierSurface*)bezier_list.GetSurface();
109
110 if(bez_ptr->IsActive())
111 {
112 if(distance > bez_ptr->GetDistance())
113 {
114 // Put data from closest bezier to b-spline data struct
115 closest_hit = bez_ptr->AveragePoint();
116 distance = bez_ptr->GetDistance();
117 }
118 else
119 {
120 // Set other beziers as inactive
121 bez_ptr->SetActive(0);
122
123 // Remove beziers that are not closest
124 // bezier_list.RemoveSurface(bez_ptr);
125 }
126 }
127
128 bezier_list.Step();
129 }
130
131 bezier_list.MoveToFirst();
132
133 if(bezier_list.GetSize())
134 return 1;
135 else
136 {
137 active=0;
138 return 0;
139 }
140}
G4Point3D AveragePoint() const
G4int GetSize() const
G4Surface * GetSurface()
void MoveToFirst(G4Surface *srf)
G4int IsActive() const
void SetActive(G4int act)
G4int Intersected
Definition: G4Surface.hh:194
G4Point3D closest_hit
Definition: G4Surface.hh:186
G4int active
Definition: G4Surface.hh:202
G4double GetDistance() const

◆ MyType()

G4int G4BSplineSurface::MyType ( ) const
inlinevirtual

Reimplemented from G4Surface.

◆ Reset()

void G4BSplineSurface::Reset ( )
inlinevirtual

Reimplemented from G4Surface.


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