#include <G4NURBS.hh>
Inheritance diagram for G4NURBS:
Definition at line 51 of file G4NURBS.hh.
typedef Float G4NURBS::G4Float [protected] |
Definition at line 168 of file G4NURBS.hh.
typedef G4Float G4NURBS::t_Coord [protected] |
Definition at line 181 of file G4NURBS.hh.
typedef t_Coord G4NURBS::t_CtrlPt[NofC] [protected] |
Definition at line 182 of file G4NURBS.hh.
typedef G4double G4NURBS::t_doubleCtrlPt[NofC] |
Definition at line 110 of file G4NURBS.hh.
typedef G4float G4NURBS::t_floatCtrlPt[NofC] |
Definition at line 111 of file G4NURBS.hh.
typedef unsigned int G4NURBS::t_indCoord |
Definition at line 90 of file G4NURBS.hh.
typedef unsigned int G4NURBS::t_indCtrlPt |
Definition at line 91 of file G4NURBS.hh.
typedef t_index G4NURBS::t_inddCtrlPt |
Definition at line 92 of file G4NURBS.hh.
typedef unsigned int G4NURBS::t_index |
Definition at line 84 of file G4NURBS.hh.
typedef t_index G4NURBS::t_indKnot |
Definition at line 87 of file G4NURBS.hh.
typedef G4Float G4NURBS::t_Knot |
Definition at line 176 of file G4NURBS.hh.
typedef t_index G4NURBS::t_order |
Definition at line 173 of file G4NURBS.hh.
anonymous enum |
enum G4NURBS::t_CheckFlag [protected] |
enum G4NURBS::t_direction |
Definition at line 319 of file G4NURBS.hh.
00320 { 00321 UserDefined, // The user will fill the array (in the child constructor 00322 // for instance). 00323 00324 Regular, // First and last knot repeated order time 00325 // other knots regularly spaced, unrepeated. 00326 // Typically used for "linear" knots vector 00327 00328 RegularRep // First and last knot repeated order time 00329 // other knots regularly spaced but repeated one time. 00330 // Typically used for "circular" knots vector and alikes. 00331 }; //t_KnotVectorGenFlag
G4NURBS::~G4NURBS | ( | ) | [virtual] |
Definition at line 546 of file G4NURBS.cc.
References m, mpCtrlPts, NofD, G4NURBS::t_Dir::pKnots, U, and V.
00547 { 00548 // we must free the two knots vector 00549 t_direction dir; 00550 G4int dummy; 00551 for (dummy=0; (dummy?(dir=V):(dir=U)),(dummy < NofD); dummy++) 00552 { 00553 if (m[dir].pKnots) 00554 delete m[dir].pKnots; // [m[dir].nbrKnots] if t_Knot become a class 00555 m[dir].pKnots = 0; 00556 } 00557 // now we free the CtrlPts array 00558 if (mpCtrlPts) 00559 delete [] mpCtrlPts; // [mtotnbrCtrlPts] if t_CtrlPt become a class 00560 mpCtrlPts = 0; 00561 }
G4NURBS::G4NURBS | ( | t_order | in_Uorder, | |
t_order | in_Vorder, | |||
t_inddCtrlPt | in_UnbrCtrlPts, | |||
t_inddCtrlPt | in_VnbrCtrlPts, | |||
t_CtrlPt * | in_pCtrlPts, | |||
t_Knot * | in_pUKnots = 0 , |
|||
t_Knot * | in_pVKnots = 0 , |
|||
t_CheckFlag | in_CheckFlag = check | |||
) | [protected] |
Definition at line 412 of file G4NURBS.cc.
References FatalException, G4endl, G4Exception(), m, MakeKnotVector(), mpCtrlPts, mtotnbrCtrlPts, G4NURBS::t_Dir::nbrCtrlPts, G4NURBS::t_Dir::nbrKnots, NofD, G4NURBS::t_Dir::order, Regular, Tochar(), U, and V.
00417 { 00418 m[U].order=in_Uorder; m[V].order=in_Vorder; 00419 m[U].nbrCtrlPts=in_UnbrCtrlPts; m[V].nbrCtrlPts=in_VnbrCtrlPts; 00420 00421 mtotnbrCtrlPts = m[U].nbrCtrlPts * m[V].nbrCtrlPts; 00422 m[U].nbrKnots = m[U].order + m[U].nbrCtrlPts; 00423 m[V].nbrKnots = m[V].order + m[V].nbrCtrlPts; 00424 00425 if (in_CheckFlag) 00426 Conscheck(); 00427 00428 // CtrlPts 00429 if (! (mpCtrlPts = in_pCtrlPts) ) 00430 { 00431 G4ExceptionDescription ed; 00432 ed << "A NURBS MUST HAVE CONTROL POINTS!\n" 00433 << "\teven if they are defined later, the array must be allocated." 00434 << G4endl; 00435 G4Exception("G4NURBS::G4NURBS()", 00436 "greps9003", FatalException, ed); 00437 } 00438 //mnbralias = 0; 00439 00440 // Knots 00441 t_direction dir; 00442 G4int dummy; 00443 for (dummy=0; (dummy?(dir=V):(dir=U)),(dummy < NofD); dummy++) 00444 { 00445 if ( !(m[dir].pKnots = (dummy?in_pVKnots:in_pUKnots)) ) 00446 { // make some regular knots between 0 & 1 00447 if(!MakeKnotVector(m[dir], Regular)) 00448 { 00449 G4ExceptionDescription ed; 00450 ed << "Unable to make a Regular knot vector along " 00451 << G4NURBS::Tochar(dir) 00452 << " direction." 00453 << G4endl; 00454 G4Exception("G4NURBS::G4NURBS()", 00455 "greps9004", FatalException, ed); 00456 } 00457 //m[dir].nbralias = 0; 00458 } // end of knots-making 00459 } // end for dummy 00460 } // end of G4NURBS::G4NURBS
G4NURBS::G4NURBS | ( | t_order | in_Uorder, | |
t_order | in_Vorder, | |||
t_inddCtrlPt | in_UnbrCtrlPts, | |||
t_inddCtrlPt | in_VnbrCtrlPts, | |||
t_KnotVectorGenFlag | in_UKVGFlag = Regular , |
|||
t_KnotVectorGenFlag | in_VKVGFlag = Regular , |
|||
t_CheckFlag | in_CheckFlag = check | |||
) | [protected] |
Definition at line 464 of file G4NURBS.cc.
References FatalException, G4endl, G4Exception(), m, MakeKnotVector(), mpCtrlPts, mtotnbrCtrlPts, G4NURBS::t_Dir::nbrCtrlPts, G4NURBS::t_Dir::nbrKnots, NofD, G4NURBS::t_Dir::order, G4NURBS::t_Dir::pKnots, Tochar(), U, UserDefined, and V.
00469 { 00470 m[U].order=in_Uorder; m[V].order=in_Vorder; 00471 m[U].nbrCtrlPts=in_UnbrCtrlPts; m[V].nbrCtrlPts=in_VnbrCtrlPts; 00472 00473 mtotnbrCtrlPts = m[U].nbrCtrlPts * m[V].nbrCtrlPts; 00474 m[U].nbrKnots = m[U].order + m[U].nbrCtrlPts; 00475 m[V].nbrKnots = m[V].order + m[V].nbrCtrlPts; 00476 00477 if (in_CheckFlag) 00478 Conscheck(); 00479 00480 // Allocate CtrlPts 00481 mpCtrlPts = new t_CtrlPt [mtotnbrCtrlPts]; 00482 //mnbralias = 0; 00483 00484 // Knots 00485 t_direction dir; 00486 G4int dummy; 00487 for (dummy=0; (dummy?(dir=V):(dir=U)),(dummy < NofD); dummy++) 00488 { 00489 t_KnotVectorGenFlag flag = (dummy?in_VKVGFlag:in_UKVGFlag); 00490 m[dir].pKnots = 0; // (allocation under our control) 00491 if ( flag != UserDefined && !MakeKnotVector(m[dir], flag) ) 00492 { 00493 G4ExceptionDescription ed; 00494 ed << "Unable to make knot vector along " 00495 << G4NURBS::Tochar(dir) 00496 << " direction. (" << m[dir].nbrKnots 00497 << " knots requested for a " 00498 << flag 00499 << " knots vector)" 00500 << G4endl; 00501 G4Exception("G4NURBS::G4NURBS()", 00502 "greps9005", FatalException, ed); 00503 } 00504 //m[dir].nbralias = 0; 00505 } 00506 }
void G4NURBS::CalcPoint | ( | G4double | u, | |
G4double | v, | |||
G4Point3D & | p, | |||
G4Vector3D & | utan, | |||
G4Vector3D & | vtan | |||
) | const |
Definition at line 659 of file G4NURBS.cc.
References GetdoubleCtrlPt(), GetUnbrCtrlPts(), GetUorder(), GetVnbrCtrlPts(), GetVorder(), m, MAXORDER, U, V, W, X, Y, and Z.
00661 { 00662 #define MAXORDER 50 00663 struct Point4 00664 { 00665 G4double x, y, z, w; 00666 }; 00667 00668 G4int i, j, ri, rj; 00669 G4int ubrkPoint, ufirst; 00670 G4double bu[MAXORDER], buprime[MAXORDER]; 00671 G4int vbrkPoint, vfirst; 00672 G4double bv[MAXORDER], bvprime[MAXORDER]; 00673 Point4 r, rutan, rvtan; 00674 00675 r.x = 0.0; r.y = 0.0; r.z = 0.0; r.w = 0.0; 00676 rutan = r; rvtan = r; 00677 00678 G4int numU = GetUnbrCtrlPts(); 00679 G4int numV = GetVnbrCtrlPts(); 00680 G4int orderU = GetUorder(); 00681 G4int orderV = GetVorder(); 00682 00683 /* Evaluate non-uniform basis functions (and derivatives) */ 00684 00685 ubrkPoint = FindBreakPoint(u, m[U].pKnots, numU-1, orderU); 00686 ufirst = ubrkPoint - orderU + 1; 00687 BasisFunctions (u, ubrkPoint, m[U].pKnots, orderU, bu); 00688 BasisDerivatives(u, ubrkPoint, m[U].pKnots, orderU, buprime); 00689 00690 vbrkPoint = FindBreakPoint(v, m[V].pKnots, numV-1, orderV); 00691 vfirst = vbrkPoint - orderV + 1; 00692 BasisFunctions (v, vbrkPoint, m[V].pKnots, orderV, bv); 00693 BasisDerivatives(v, vbrkPoint, m[V].pKnots, orderV, bvprime); 00694 00695 /* Weight control points against the basis functions */ 00696 00697 t_doubleCtrlPt *cpoint; 00698 Point4 cp; 00699 G4double tmp; 00700 00701 for (i=0; i<orderV; i++) 00702 { 00703 for (j=0; j<orderU; j++) 00704 { 00705 ri = orderV - 1 - i; 00706 rj = orderU - 1 - j; 00707 00708 tmp = bu[rj] * bv[ri]; 00709 00710 cpoint = GetdoubleCtrlPt(j+ufirst, i+vfirst); 00711 cp.x = *cpoint[G4NURBS::X]; 00712 cp.y = *cpoint[G4NURBS::Y]; 00713 cp.z = *cpoint[G4NURBS::Z]; 00714 cp.w = *cpoint[G4NURBS::W]; 00715 delete [] cpoint; 00716 00717 r.x += cp.x * tmp; 00718 r.y += cp.y * tmp; 00719 r.z += cp.z * tmp; 00720 r.w += cp.w * tmp; 00721 00722 tmp = buprime[rj] * bv[ri]; 00723 rutan.x += cp.x * tmp; 00724 rutan.y += cp.y * tmp; 00725 rutan.z += cp.z * tmp; 00726 rutan.w += cp.w * tmp; 00727 00728 tmp = bu[rj] * bvprime[ri]; 00729 rvtan.x += cp.x * tmp; 00730 rvtan.y += cp.y * tmp; 00731 rvtan.z += cp.z * tmp; 00732 rvtan.w += cp.w * tmp; 00733 } 00734 } 00735 00736 /* Project tangents, using the quotient rule for differentiation */ 00737 00738 G4double wsqrdiv = 1.0 / (r.w * r.w); 00739 00740 utan.setX((r.w * rutan.x - rutan.w * r.x) * wsqrdiv); 00741 utan.setY((r.w * rutan.y - rutan.w * r.y) * wsqrdiv); 00742 utan.setZ((r.w * rutan.z - rutan.w * r.z) * wsqrdiv); 00743 00744 vtan.setX((r.w * rvtan.x - rvtan.w * r.x) * wsqrdiv); 00745 vtan.setY((r.w * rvtan.y - rvtan.w * r.y) * wsqrdiv); 00746 vtan.setZ((r.w * rvtan.z - rvtan.w * r.z) * wsqrdiv); 00747 00748 p.setX(r.x / r.w); 00749 p.setY(r.y / r.w); 00750 p.setZ(r.z / r.w); 00751 }
void G4NURBS::CP | ( | G4NURBS::t_CtrlPt & | rcp, | |
t_Coord | x, | |||
t_Coord | y, | |||
t_Coord | z, | |||
t_Coord | w, | |||
G4Float | factor | |||
) | [inline, static, protected] |
Definition at line 530 of file G4NURBS.hh.
00532 { 00533 rcp[G4NURBS::X]=factor*x; 00534 rcp[G4NURBS::Y]=factor*y; 00535 rcp[G4NURBS::Z]=factor*z; 00536 rcp[G4NURBS::W]=factor*w; 00537 }
void G4NURBS::CP | ( | G4NURBS::t_CtrlPt & | rcp, | |
t_Coord | x, | |||
t_Coord | y, | |||
t_Coord | z, | |||
t_Coord | w | |||
) | [inline, static, protected] |
Definition at line 520 of file G4NURBS.hh.
Referenced by G4NURBSbox::G4NURBSbox(), G4NURBScylinder::G4NURBScylinder(), G4NURBShexahedron::G4NURBShexahedron(), G4NURBStube::G4NURBStube(), and G4NURBStubesector::G4NURBStubesector().
00522 { 00523 rcp[G4NURBS::X]=x; 00524 rcp[G4NURBS::Y]=y; 00525 rcp[G4NURBS::Z]=z; 00526 rcp[G4NURBS::W]=w; 00527 }
G4double * G4NURBS::GetdoubleAllCtrlPts | ( | ) | const |
Definition at line 226 of file G4NURBS.cc.
References mpCtrlPts, mtotnbrCtrlPts, and NofC.
00227 { 00228 G4double * p = new G4double [mtotnbrCtrlPts*NofC]; 00229 for (t_indKnot i = 0; i < mtotnbrCtrlPts*NofC; i++) 00230 p[i] = (G4double)(((t_Coord *)mpCtrlPts)[i]); 00231 return p; 00232 }
G4double * G4NURBS::GetdoubleAllKnots | ( | t_direction | in_dir | ) | const |
Definition at line 209 of file G4NURBS.cc.
References DMask, m, and G4NURBS::t_Dir::nbrKnots.
00210 { 00211 in_dir = (t_direction)(in_dir & DMask); 00212 G4double * p = new G4double [m[in_dir].nbrKnots]; 00213 for (t_indKnot i = 0; i < m[in_dir].nbrKnots; i++) 00214 p[i] = (G4double)m[in_dir].pKnots[i]; 00215 return p; 00216 }
G4NURBS::t_doubleCtrlPt * G4NURBS::GetdoubleCtrlPt | ( | t_inddCtrlPt | in_Uindex, | |
t_inddCtrlPt | in_Vindex | |||
) | const |
Definition at line 184 of file G4NURBS.cc.
References G4cerr, G4endl, m, mpCtrlPts, mtotnbrCtrlPts, G4NURBS::t_Dir::nbrCtrlPts, To1d(), TodoubleCtrlPt(), U, and V.
00185 { 00186 if ( (in_Uindex < m[U].nbrCtrlPts) && (in_Vindex < m[V].nbrCtrlPts) ) 00187 return TodoubleCtrlPt(mpCtrlPts[To1d(in_Uindex, in_Vindex)]); 00188 else 00189 { 00190 G4cerr << "\nERROR: G4NURBS::GetdoubleCtrlPt: index(s) out of range" 00191 << "\n\t in_Uindex : " << in_Uindex 00192 << " , in_Vindex : " << in_Vindex 00193 << " , UnbrCtrlPts : " << m[U].nbrCtrlPts 00194 << " , VnbrCtrlPts : " << m[V].nbrCtrlPts << G4endl; 00195 return TodoubleCtrlPt(mpCtrlPts[mtotnbrCtrlPts-1]); 00196 } 00197 }
G4NURBS::t_doubleCtrlPt * G4NURBS::GetdoubleCtrlPt | ( | t_indCtrlPt | in_onedimindex | ) | const |
Definition at line 170 of file G4NURBS.cc.
References G4cerr, G4endl, mpCtrlPts, mtotnbrCtrlPts, and TodoubleCtrlPt().
Referenced by CalcPoint().
00171 { 00172 if ( in_onedimindex < mtotnbrCtrlPts ) 00173 return TodoubleCtrlPt(mpCtrlPts[in_onedimindex]); 00174 else 00175 { 00176 G4cerr << "\nERROR: G4NURBS::getdoubleCtrlPts: index out of range" 00177 << "\n\t in_onedimindex : " << in_onedimindex 00178 << " , mtotnbrCtrlPts : " << mtotnbrCtrlPts << G4endl; 00179 return TodoubleCtrlPt(mpCtrlPts[mtotnbrCtrlPts-1]); 00180 } 00181 }
G4double G4NURBS::GetdoubleKnot | ( | t_direction | in_dir, | |
t_indKnot | in_index | |||
) | const |
Definition at line 123 of file G4NURBS.cc.
References DMask, G4cerr, G4endl, m, G4NURBS::t_Dir::nbrKnots, and G4NURBS::t_Dir::pKnots.
00124 { 00125 in_dir = (t_direction)(in_dir & DMask); 00126 if ( in_index < m[in_dir].nbrKnots ) 00127 return (G4double)(m[in_dir].pKnots[in_index]); 00128 else 00129 { 00130 G4cerr << "\nERROR: G4NURBS::GetdoubleKnot: index out of range" 00131 << "\n\t in_dir : " << G4int(in_dir) 00132 << ", in_index : " << G4int(in_index) 00133 << "m[in_dir].nbrKnots : " << m[in_dir].nbrKnots 00134 << G4endl; 00135 return (G4double)(m[in_dir].pKnots[m[in_dir].nbrKnots-1]); 00136 } 00137 }
G4float * G4NURBS::GetfloatAllCtrlPts | ( | ) | const |
Definition at line 218 of file G4NURBS.cc.
References mpCtrlPts, mtotnbrCtrlPts, and NofC.
00219 { 00220 G4float * p = new G4float [mtotnbrCtrlPts*NofC]; 00221 for (t_indKnot i = 0; i < mtotnbrCtrlPts*NofC; i++) 00222 p[i] = (G4float)(((t_Coord *)mpCtrlPts)[i]); 00223 return p; 00224 }
G4float * G4NURBS::GetfloatAllKnots | ( | t_direction | in_dir | ) | const |
Definition at line 200 of file G4NURBS.cc.
References DMask, m, and G4NURBS::t_Dir::nbrKnots.
00201 { 00202 in_dir = (t_direction)(in_dir & DMask); 00203 G4float * p = new G4float [m[in_dir].nbrKnots]; 00204 for (t_indKnot i = 0; i < m[in_dir].nbrKnots; i++) 00205 p[i] = (G4float)m[in_dir].pKnots[i]; 00206 return p; 00207 }
G4NURBS::t_floatCtrlPt * G4NURBS::GetfloatCtrlPt | ( | t_inddCtrlPt | in_Uindex, | |
t_inddCtrlPt | in_Vindex | |||
) | const |
Definition at line 154 of file G4NURBS.cc.
References G4cerr, G4endl, m, mpCtrlPts, mtotnbrCtrlPts, G4NURBS::t_Dir::nbrCtrlPts, To1d(), TofloatCtrlPt(), U, and V.
00155 { 00156 if ( (in_Uindex < m[U].nbrCtrlPts) && (in_Vindex < m[V].nbrCtrlPts) ) 00157 return TofloatCtrlPt(mpCtrlPts[To1d(in_Uindex, in_Vindex)]); 00158 else 00159 { 00160 G4cerr << "\nERROR: G4NURBS::GetfloatCtrlPt: index(s) out of range" 00161 << "\n\t in_Uindex : " << in_Uindex 00162 << " , in_Vindex : " << in_Vindex 00163 << " , UnbrCtrlPts : " << m[U].nbrCtrlPts 00164 << " , VnbrCtrlPts : " << m[V].nbrCtrlPts << G4endl; 00165 return TofloatCtrlPt(mpCtrlPts[mtotnbrCtrlPts-1]); 00166 } 00167 }
G4NURBS::t_floatCtrlPt * G4NURBS::GetfloatCtrlPt | ( | t_indCtrlPt | in_onedimindex | ) | const |
Definition at line 140 of file G4NURBS.cc.
References G4cerr, G4endl, mpCtrlPts, mtotnbrCtrlPts, and TofloatCtrlPt().
00141 { 00142 if (in_onedimindex < mtotnbrCtrlPts) 00143 return TofloatCtrlPt(mpCtrlPts[in_onedimindex]); 00144 else 00145 { 00146 G4cerr << "\nERROR: G4NURBS::GetfloatCtrlPt: index out of range" 00147 << "\n\t in_onedimindex : " << in_onedimindex 00148 << " , mtotnbrCtrlPts : " << mtotnbrCtrlPts << G4endl; 00149 return TofloatCtrlPt(mpCtrlPts[mtotnbrCtrlPts-1]); 00150 } 00151 }
G4float G4NURBS::GetfloatKnot | ( | t_direction | in_dir, | |
t_indKnot | in_index | |||
) | const |
Definition at line 108 of file G4NURBS.cc.
References DMask, G4cerr, G4endl, m, and G4NURBS::t_Dir::nbrKnots.
00109 { 00110 in_dir = (t_direction)(in_dir & DMask); 00111 if ( in_index < m[in_dir].nbrKnots ) 00112 return ((G4float)(m[in_dir].pKnots[in_index])); 00113 else 00114 { 00115 G4cerr << "\nERROR: G4NURBS::GetfloatKnot: index out of range\n" 00116 << "\n\t in_dir : " << G4int(in_dir) 00117 << ", in_index : " << G4int(in_index) 00118 << "m[in_dir].nbrKnots : " << m[in_dir].nbrKnots << G4endl; 00119 return ((G4float)m[in_dir].pKnots[m[in_dir].nbrKnots-1]); 00120 } 00121 }
G4int G4NURBS::GetnbrCtrlPts | ( | t_direction | in_dir | ) | const [inline] |
Definition at line 463 of file G4NURBS.hh.
References DMask, m, and G4NURBS::t_Dir::nbrCtrlPts.
00463 { 00464 return m[in_dir & DMask].nbrCtrlPts; 00465 }
G4int G4NURBS::GetnbrKnots | ( | t_direction | in_dir | ) | const [inline] |
Definition at line 459 of file G4NURBS.hh.
References DMask, m, and G4NURBS::t_Dir::nbrKnots.
Referenced by operator<<().
G4int G4NURBS::Getorder | ( | t_direction | in_dir | ) | const [inline] |
G4int G4NURBS::GettotalnbrCtrlPts | ( | ) | const [inline] |
Definition at line 437 of file G4NURBS.hh.
References mtotnbrCtrlPts.
00437 { return mtotnbrCtrlPts; }
G4double G4NURBS::GetUmax | ( | ) | const [inline] |
Definition at line 443 of file G4NURBS.hh.
References GetUnbrCtrlPts(), m, G4NURBS::t_Dir::pKnots, and U.
00443 { 00444 return (G4double) m[U].pKnots[GetUnbrCtrlPts()]; 00445 }
G4double G4NURBS::GetUmin | ( | ) | const [inline] |
Definition at line 439 of file G4NURBS.hh.
References GetUorder(), m, G4NURBS::t_Dir::pKnots, and U.
G4int G4NURBS::GetUnbrCtrlPts | ( | ) | const [inline] |
Definition at line 435 of file G4NURBS.hh.
References m, G4NURBS::t_Dir::nbrCtrlPts, and U.
Referenced by CalcPoint(), GetUmax(), and operator<<().
00435 { return m[U].nbrCtrlPts; }
G4int G4NURBS::GetUnbrKnots | ( | ) | const [inline] |
G4int G4NURBS::GetUorder | ( | ) | const [inline] |
Definition at line 431 of file G4NURBS.hh.
References m, G4NURBS::t_Dir::order, and U.
Referenced by CalcPoint(), GetUmin(), and operator<<().
G4double G4NURBS::GetVmax | ( | ) | const [inline] |
Definition at line 451 of file G4NURBS.hh.
References GetVnbrCtrlPts(), m, G4NURBS::t_Dir::pKnots, and V.
00451 { 00452 return (G4double) m[V].pKnots[GetVnbrCtrlPts()]; 00453 }
G4double G4NURBS::GetVmin | ( | ) | const [inline] |
Definition at line 447 of file G4NURBS.hh.
References GetVorder(), m, G4NURBS::t_Dir::pKnots, and V.
G4int G4NURBS::GetVnbrCtrlPts | ( | ) | const [inline] |
Definition at line 436 of file G4NURBS.hh.
References m, G4NURBS::t_Dir::nbrCtrlPts, and V.
Referenced by CalcPoint(), GetVmax(), and operator<<().
00436 { return m[V].nbrCtrlPts; }
G4int G4NURBS::GetVnbrKnots | ( | ) | const [inline] |
G4int G4NURBS::GetVorder | ( | ) | const [inline] |
Definition at line 432 of file G4NURBS.hh.
References m, G4NURBS::t_Dir::order, and V.
Referenced by CalcPoint(), GetVmin(), and operator<<().
G4bool G4NURBS::MakeKnotVector | ( | t_Dir * | p_inoutdirdat, | |
t_KnotVectorGenFlag | in_KVGFlag | |||
) | [inline, static, protected] |
Definition at line 507 of file G4NURBS.hh.
References MakeKnotVector().
00509 { 00510 return MakeKnotVector(*p_inoutdirdat, in_KVGFlag); 00511 }
G4bool G4NURBS::MakeKnotVector | ( | t_Dir & | inout_dirdat, | |
t_KnotVectorGenFlag | in_KVGFlag | |||
) | [static, protected] |
Definition at line 331 of file G4NURBS.cc.
References G4NURBS::t_Dir::nbrCtrlPts, G4NURBS::t_Dir::nbrKnots, G4NURBS::t_Dir::order, G4NURBS::t_Dir::pKnots, and UserDefined.
Referenced by G4NURBS(), and MakeKnotVector().
00332 { 00333 G4bool isgood = (io_d.order + io_d.nbrCtrlPts == io_d.nbrKnots) 00334 && (io_d.pKnots == 0); 00335 if ( isgood ) 00336 { 00337 io_d.pKnots = new t_Knot [io_d.nbrKnots]; 00338 if (in_KVGFlag != UserDefined) 00339 { // let's do the knots 00340 t_indKnot indKnot = 0; 00341 t_index nbrCentralDistinctKnots = io_d.nbrCtrlPts-io_d.order; 00342 if ( (nbrCentralDistinctKnots % in_KVGFlag) == 0) 00343 { 00344 nbrCentralDistinctKnots /= in_KVGFlag; 00345 // first and last knots repeated 'order' Times 00346 for (t_index i=0; i < io_d.order; indKnot++,i++) 00347 { 00348 io_d.pKnots[indKnot] = 0; 00349 io_d.pKnots[indKnot+io_d.nbrCtrlPts] = 1; 00350 } 00351 00352 t_Knot stepKnot = 1.0/(t_Knot)(nbrCentralDistinctKnots+1); 00353 t_Knot valKnot = stepKnot; 00354 00355 // central knots 00356 for (t_indKnot j=0; j<nbrCentralDistinctKnots; valKnot+=stepKnot, j++) 00357 { 00358 for (t_indKnot k=0; k<t_indKnot(in_KVGFlag); indKnot++, k++) 00359 io_d.pKnots[indKnot] = valKnot; 00360 } 00361 } 00362 else isgood = false; 00363 } // end of knots making 00364 } 00365 return isgood; 00366 }
G4NURBS::t_indCtrlPt G4NURBS::To1d | ( | t_inddCtrlPt | in_Uindex, | |
t_inddCtrlPt | in_Vindex | |||
) | const [inline, protected] |
Definition at line 481 of file G4NURBS.hh.
References m, G4NURBS::t_Dir::nbrCtrlPts, and U.
Referenced by G4NURBShexahedron::G4NURBShexahedron(), GetdoubleCtrlPt(), and GetfloatCtrlPt().
00482 { 00483 return in_Uindex + in_Vindex*m[U].nbrCtrlPts; 00484 }
char G4NURBS::Tochar | ( | t_direction | in_dir | ) | [inline, static] |
Definition at line 467 of file G4NURBS.hh.
References U.
Referenced by G4NURBS(), and operator<<().
00467 { 00468 return (in_dir != U? 'V': 'U'); 00469 }
G4NURBS::t_doubleCtrlPt * G4NURBS::TodoubleCtrlPt | ( | const t_CtrlPt & | ) | [inline, static, protected] |
Definition at line 498 of file G4NURBS.hh.
Referenced by GetdoubleCtrlPt().
00499 { 00500 G4NURBS::t_doubleCtrlPt * pcopy = new G4NURBS::t_doubleCtrlPt [4]; 00501 for (G4int indCoord = X; indCoord < NofC; indCoord++) 00502 (*pcopy)[indCoord] = (G4double)in_krcp[indCoord]; 00503 return pcopy; 00504 }
G4NURBS::t_floatCtrlPt * G4NURBS::TofloatCtrlPt | ( | const t_CtrlPt & | ) | [inline, static, protected] |
Definition at line 488 of file G4NURBS.hh.
Referenced by GetfloatCtrlPt().
00489 { 00490 G4NURBS::t_floatCtrlPt * pcopy = new G4NURBS::t_floatCtrlPt [1]; 00491 for (G4int indCoord = X; indCoord < NofC; indCoord++) 00492 (*pcopy)[indCoord] = (G4float)in_krcp[indCoord]; 00493 return pcopy; 00494 }
virtual const char* G4NURBS::Whoami | ( | ) | const [pure virtual] |
Implemented in G4NURBSbox, G4NURBScylinder, G4NURBShexahedron, G4NURBStube, and G4NURBStubesector.
Referenced by operator<<().
friend class CtrlPtsCoordsIterator [friend] |
Definition at line 202 of file G4NURBS.hh.
friend class CtrlPtsIterator [friend] |
Definition at line 203 of file G4NURBS.hh.
friend class KnotsIterator [friend] |
Definition at line 198 of file G4NURBS.hh.
std::ostream& operator<< | ( | std::ostream & | inout_OutStream, | |
t_KnotVectorGenFlag | in_KVGFlag | |||
) | [friend] |
t_Dir G4NURBS::m[NofD] [protected] |
Definition at line 348 of file G4NURBS.hh.
Referenced by CalcPoint(), G4NURBS(), G4NURBScylinder::G4NURBScylinder(), GetdoubleAllKnots(), GetdoubleCtrlPt(), GetdoubleKnot(), GetfloatAllKnots(), GetfloatCtrlPt(), GetfloatKnot(), GetnbrCtrlPts(), GetnbrKnots(), Getorder(), GetUmax(), GetUmin(), GetUnbrCtrlPts(), GetUnbrKnots(), GetUorder(), GetVmax(), GetVmin(), GetVnbrCtrlPts(), GetVnbrKnots(), GetVorder(), G4NURBS::KnotsIterator::KnotsIterator(), To1d(), and ~G4NURBS().
t_CtrlPt* G4NURBS::mpCtrlPts [protected] |
Definition at line 350 of file G4NURBS.hh.
Referenced by G4NURBS::CtrlPtsCoordsIterator::CtrlPtsCoordsIterator(), G4NURBS::CtrlPtsIterator::CtrlPtsIterator(), G4NURBS(), G4NURBSbox::G4NURBSbox(), G4NURBScylinder::G4NURBScylinder(), G4NURBShexahedron::G4NURBShexahedron(), G4NURBStube::G4NURBStube(), G4NURBStubesector::G4NURBStubesector(), GetdoubleAllCtrlPts(), GetdoubleCtrlPt(), GetfloatAllCtrlPts(), GetfloatCtrlPt(), and ~G4NURBS().
t_indCtrlPt G4NURBS::mtotnbrCtrlPts [protected] |
Definition at line 349 of file G4NURBS.hh.
Referenced by G4NURBS::CtrlPtsCoordsIterator::CtrlPtsCoordsIterator(), G4NURBS::CtrlPtsIterator::CtrlPtsIterator(), G4NURBS(), G4NURBStubesector::G4NURBStubesector(), GetdoubleAllCtrlPts(), GetdoubleCtrlPt(), GetfloatAllCtrlPts(), GetfloatCtrlPt(), and GettotalnbrCtrlPts().