#include <G4ControlPoints.hh>
Public Member Functions | |
G4ControlPoints () | |
G4ControlPoints (G4int, G4int) | |
G4ControlPoints (G4int, G4int, G4int) | |
G4ControlPoints (const G4ControlPoints &) | |
~G4ControlPoints () | |
G4ControlPoints & | operator= (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 |
G4PointRat & | GetRat (G4int i, G4int j) const |
G4double | ClosestDistanceToPoint (const G4Point3D &) |
Definition at line 45 of file G4ControlPoints.hh.
G4ControlPoints::G4ControlPoints | ( | ) |
Definition at line 39 of file G4ControlPoints.cc.
00040 { 00041 nr=nc=0; 00042 data=(G4PointRat**)0; 00043 }
Definition at line 46 of file G4ControlPoints.cc.
00047 { 00048 nr=rows; 00049 nc=columns; 00050 data = (G4PointRat**) new G4PointRat *[nr*nc]; 00051 00052 for(G4int a =0; a<nr*nc;a++) 00053 data[a]=new G4PointRat; 00054 }
Definition at line 57 of file G4ControlPoints.cc.
00058 { 00059 00060 // point_type is maintained only for compatibility 00061 // G4ControlPoints is now a array of G4pointRat only 00062 00063 nr=rows; 00064 nc=columns; 00065 data = (G4PointRat**)new G4PointRat *[nr*nc]; 00066 00067 for(G4int a = 0; a < nr*nc ; a++ ) 00068 data[a]=new G4PointRat; 00069 }
G4ControlPoints::G4ControlPoints | ( | const G4ControlPoints & | ) |
Definition at line 72 of file G4ControlPoints.cc.
References GetRat(), nc, nr, and put().
00073 { 00074 // copy constructor 00075 00076 for( G4int i = 0; i < nr*nc; i++) 00077 delete data[i]; 00078 delete[] data; 00079 00080 nr = old_points.nr; 00081 nc = old_points.nc; 00082 data = (G4PointRat**)new G4PointRat *[nr*nc]; 00083 00084 G4int a, b; 00085 00086 for (a = 0; a < nr*nc ; a++ ) 00087 data[a] = new G4PointRat; 00088 00089 for ( a = 0; a < nr ; a++ ) 00090 for ( b = 0; b < nc ; b++ ) 00091 put( a, b, old_points.GetRat(a,b)); 00092 }
G4ControlPoints::~G4ControlPoints | ( | ) |
Definition at line 95 of file G4ControlPoints.cc.
00096 { 00097 for( G4int a = 0; a < nr*nc; a++) 00098 delete data[a]; 00099 00100 delete[] data; 00101 }
void G4ControlPoints::CalcValues | ( | G4double | k1, | |
G4double | param, | |||
G4PointRat & | pts1, | |||
G4double | k2, | |||
G4PointRat & | pts2 | |||
) |
Definition at line 138 of file G4ControlPoints.cc.
References G4PointRat::setW(), G4PointRat::setX(), G4PointRat::setY(), G4PointRat::setZ(), G4PointRat::w(), G4PointRat::x(), G4PointRat::y(), and G4PointRat::z().
00141 { 00142 pts2.setX(Calc(k1,param,pts1.x(),k2,pts2.x())); 00143 pts2.setY(Calc(k1,param,pts1.y(),k2,pts2.y())); 00144 pts2.setZ(Calc(k1,param,pts1.z(),k2,pts2.z())); 00145 pts2.setW(Calc(k1,param,pts1.w(),k2,pts2.w())); 00146 }
void G4ControlPoints::CalcValues | ( | G4double | k1, | |
G4double | param, | |||
G4Point3D & | pts1, | |||
G4double | k2, | |||
G4Point3D & | pts2 | |||
) |
Definition at line 149 of file G4ControlPoints.cc.
00151 { 00152 pts2.setX(Calc(k1,param,pts1.x(),k2,pts2.x())); 00153 pts2.setY(Calc(k1,param,pts1.y(),k2,pts2.y())); 00154 pts2.setZ(Calc(k1,param,pts1.z(),k2,pts2.z())); 00155 }
Definition at line 158 of file G4ControlPoints.cc.
References Get3D().
Referenced by G4BSplineSurface::ClosestDistanceToPoint().
00159 { 00160 // Square distance 00161 00162 G4double PointDist=1.e20; 00163 G4double TmpDist; 00164 G4Point3D Pt2; 00165 00166 for(G4int a=0;a<nr;a++) 00167 for(G4int b=0;b<nc;b++) 00168 { 00169 Pt2 = Get3D(a,b); 00170 TmpDist = Pt.distance2(Pt2); 00171 PointDist = ( PointDist > TmpDist ) ? TmpDist : PointDist; 00172 } 00173 00174 return PointDist; 00175 }
Definition at line 64 of file G4ControlPoints.icc.
Referenced by G4ProjectedSurface::CalcBBox(), G4BSplineSurface::CalcBBox(), G4BezierSurface::CalcBBox(), G4BezierSurface::ClipSurface(), ClosestDistanceToPoint(), and G4BSplineSurface::GetControlPoint().
G4int G4ControlPoints::GetCols | ( | ) | const [inline] |
Definition at line 44 of file G4ControlPoints.icc.
Referenced by G4ProjectedSurface::CalcBBox(), G4BSplineSurface::CalcBBox(), G4BezierSurface::CalcBBox(), G4BezierSurface::ClipSurface(), and G4BSplineSurface::GetCols().
G4PointRat & G4ControlPoints::GetRat | ( | G4int | i, | |
G4int | j | |||
) | const [inline] |
Definition at line 70 of file G4ControlPoints.icc.
Referenced by G4ControlPoints(), and operator=().
G4int G4ControlPoints::GetRows | ( | ) | const [inline] |
Definition at line 38 of file G4ControlPoints.icc.
Referenced by G4ProjectedSurface::CalcBBox(), G4BSplineSurface::CalcBBox(), G4BezierSurface::CalcBBox(), G4BezierSurface::ClipSurface(), and G4BSplineSurface::GetRows().
G4ControlPoints & G4ControlPoints::operator= | ( | const G4ControlPoints & | ) |
Definition at line 104 of file G4ControlPoints.cc.
References GetRat(), nc, nr, and put().
00105 { 00106 // assignment operator 00107 00108 if (&c == this) return *this; 00109 00110 for( G4int i = 0; i < nr*nc; i++) 00111 delete data[i]; 00112 delete[] data; 00113 00114 nr = c.nr; 00115 nc = c.nc; 00116 data = (G4PointRat**)new G4PointRat *[nr*nc]; 00117 00118 G4int a, b; 00119 00120 for (a = 0; a < nr*nc ; a++ ) 00121 data[a] = new G4PointRat; 00122 00123 for ( a = 0; a < nr ; a++ ) 00124 for ( b = 0; b < nc ; b++ ) 00125 put( a, b, c.GetRat(a,b)); 00126 00127 return *this; 00128 }
void G4ControlPoints::put | ( | G4int | i, | |
G4int | j, | |||
const G4PointRat & | tmp | |||
) | [inline] |
Definition at line 50 of file G4ControlPoints.icc.
Referenced by G4ControlPoints(), and operator=().
00051 { 00052 *data[i*nc+j]=tmp; // tmp is converted to a PointRat 00053 // by the member affectation function 00054 // of the G4PointRat class 00055 }
void G4ControlPoints::SetWeights | ( | G4double * | ) |
Definition at line 131 of file G4ControlPoints.cc.
00132 { 00133 for ( G4int a = 0; a < nr*nc; a++ ) 00134 (data[a])->setW(weights[a]); 00135 }