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

#include <G4ControlPoints.hh>

Public Member Functions

 G4ControlPoints ()
 
 G4ControlPoints (G4int, G4int)
 
 G4ControlPoints (G4int, G4int, G4int)
 
 G4ControlPoints (const G4ControlPoints &)
 
 ~G4ControlPoints ()
 
G4ControlPointsoperator= (const G4ControlPoints &)
 
void SetWeights (G4double *)
 
void CalcValues (G4double k1, G4double param, G4Point3D &pts1, G4double k2, G4Point3D &pts2)
 
void CalcValues (G4double k1, G4double param, G4PointRat &pts1, G4double k2, G4PointRat &pts2)
 
G4int GetRows () const
 
G4int GetCols () const
 
void put (G4int i, G4int j, const G4Point3D &tmp)
 
void put (G4int i, G4int j, const G4PointRat &tmp)
 
G4Point3D Get3D (G4int i, G4int j) const
 
G4PointRatGetRat (G4int i, G4int j) const
 
G4double ClosestDistanceToPoint (const G4Point3D &)
 

Detailed Description

Definition at line 45 of file G4ControlPoints.hh.

Constructor & Destructor Documentation

◆ G4ControlPoints() [1/4]

G4ControlPoints::G4ControlPoints ( )

Definition at line 39 of file G4ControlPoints.cc.

40{
41 nr=nc=0;
42 data=(G4PointRat**)0;
43}

◆ G4ControlPoints() [2/4]

G4ControlPoints::G4ControlPoints ( G4int  rows,
G4int  columns 
)

Definition at line 46 of file G4ControlPoints.cc.

47{
48 nr=rows;
49 nc=columns;
50 data = (G4PointRat**) new G4PointRat *[nr*nc];
51
52 for(G4int a =0; a<nr*nc;a++)
53 data[a]=new G4PointRat;
54}
int G4int
Definition: G4Types.hh:66

◆ G4ControlPoints() [3/4]

G4ControlPoints::G4ControlPoints ( G4int  ,
G4int  rows,
G4int  columns 
)

Definition at line 57 of file G4ControlPoints.cc.

58{
59
60// point_type is maintained only for compatibility
61// G4ControlPoints is now a array of G4pointRat only
62
63 nr=rows;
64 nc=columns;
65 data = (G4PointRat**)new G4PointRat *[nr*nc];
66
67 for(G4int a = 0; a < nr*nc ; a++ )
68 data[a]=new G4PointRat;
69}

◆ G4ControlPoints() [4/4]

G4ControlPoints::G4ControlPoints ( const G4ControlPoints old_points)

Definition at line 72 of file G4ControlPoints.cc.

73{
74 // copy constructor
75
76 for( G4int i = 0; i < nr*nc; i++)
77 delete data[i];
78 delete[] data;
79
80 nr = old_points.nr;
81 nc = old_points.nc;
82 data = (G4PointRat**)new G4PointRat *[nr*nc];
83
84 G4int a, b;
85
86 for (a = 0; a < nr*nc ; a++ )
87 data[a] = new G4PointRat;
88
89 for ( a = 0; a < nr ; a++ )
90 for ( b = 0; b < nc ; b++ )
91 put( a, b, old_points.GetRat(a,b));
92}
G4PointRat & GetRat(G4int i, G4int j) const
void put(G4int i, G4int j, const G4Point3D &tmp)

◆ ~G4ControlPoints()

G4ControlPoints::~G4ControlPoints ( )

Definition at line 95 of file G4ControlPoints.cc.

96{
97 for( G4int a = 0; a < nr*nc; a++)
98 delete data[a];
99
100 delete[] data;
101}

Member Function Documentation

◆ CalcValues() [1/2]

void G4ControlPoints::CalcValues ( G4double  k1,
G4double  param,
G4Point3D pts1,
G4double  k2,
G4Point3D pts2 
)

Definition at line 149 of file G4ControlPoints.cc.

151{
152 pts2.setX(Calc(k1,param,pts1.x(),k2,pts2.x()));
153 pts2.setY(Calc(k1,param,pts1.y(),k2,pts2.y()));
154 pts2.setZ(Calc(k1,param,pts1.z(),k2,pts2.z()));
155}

◆ CalcValues() [2/2]

void G4ControlPoints::CalcValues ( G4double  k1,
G4double  param,
G4PointRat pts1,
G4double  k2,
G4PointRat pts2 
)

Definition at line 138 of file G4ControlPoints.cc.

141{
142 pts2.setX(Calc(k1,param,pts1.x(),k2,pts2.x()));
143 pts2.setY(Calc(k1,param,pts1.y(),k2,pts2.y()));
144 pts2.setZ(Calc(k1,param,pts1.z(),k2,pts2.z()));
145 pts2.setW(Calc(k1,param,pts1.w(),k2,pts2.w()));
146}
G4double x() const
G4double y() const
void setX(G4double Value)
void setY(G4double Value)
G4double w() const
G4double z() const
void setZ(G4double Value)
void setW(G4double Value)

◆ ClosestDistanceToPoint()

G4double G4ControlPoints::ClosestDistanceToPoint ( const G4Point3D Pt)

Definition at line 158 of file G4ControlPoints.cc.

159{
160 // Square distance
161
162 G4double PointDist=1.e20;
163 G4double TmpDist;
164 G4Point3D Pt2;
165
166 for(G4int a=0;a<nr;a++)
167 for(G4int b=0;b<nc;b++)
168 {
169 Pt2 = Get3D(a,b);
170 TmpDist = Pt.distance2(Pt2);
171 PointDist = ( PointDist > TmpDist ) ? TmpDist : PointDist;
172 }
173
174 return PointDist;
175}
double G4double
Definition: G4Types.hh:64
G4Point3D Get3D(G4int i, G4int j) const

Referenced by G4BSplineSurface::ClosestDistanceToPoint().

◆ Get3D()

◆ GetCols()

◆ GetRat()

G4PointRat & G4ControlPoints::GetRat ( G4int  i,
G4int  j 
) const
inline

Referenced by G4ControlPoints(), and operator=().

◆ GetRows()

◆ operator=()

G4ControlPoints & G4ControlPoints::operator= ( const G4ControlPoints c)

Definition at line 104 of file G4ControlPoints.cc.

105{
106 // assignment operator
107
108 if (&c == this) return *this;
109
110 for( G4int i = 0; i < nr*nc; i++)
111 delete data[i];
112 delete[] data;
113
114 nr = c.nr;
115 nc = c.nc;
116 data = (G4PointRat**)new G4PointRat *[nr*nc];
117
118 G4int a, b;
119
120 for (a = 0; a < nr*nc ; a++ )
121 data[a] = new G4PointRat;
122
123 for ( a = 0; a < nr ; a++ )
124 for ( b = 0; b < nc ; b++ )
125 put( a, b, c.GetRat(a,b));
126
127 return *this;
128}

◆ put() [1/2]

void G4ControlPoints::put ( G4int  i,
G4int  j,
const G4Point3D tmp 
)
inline

Referenced by G4ControlPoints(), and operator=().

◆ put() [2/2]

void G4ControlPoints::put ( G4int  i,
G4int  j,
const G4PointRat tmp 
)
inline

◆ SetWeights()

void G4ControlPoints::SetWeights ( G4double weights)

Definition at line 131 of file G4ControlPoints.cc.

132{
133 for ( G4int a = 0; a < nr*nc; a++ )
134 (data[a])->setW(weights[a]);
135}

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