7 #include <Base/Debug/Error.hh>
8 #include "NurbsBase.hh"
16 NurbsBase::NurbsBase(
int knotsPerDim,
int degree,
int dimension){
18 knotsPerDim_ = knotsPerDim;
21 for(
int i = 0; i < degree; i++) kVec.push_back(0.0);
22 for(
int i = 0; i < knotsPerDim ; i++) kVec.push_back((
double)i / (
double)(knotsPerDim-1));
23 for(
int i = 0; i < degree; i++) kVec.push_back(1.0);
24 for(
int d = 0; d < dimension; d++) knotVector_.push_back(kVec);
25 #ifndef NURBS_BASE_THREAD_SAFE
26 evalCache_.resize(degree+1);
27 #endif //NURBS_BASE_THREAD_SAFE
29 numCtrlPoints_ = knotsPerDim+degree_-1;
33 #ifdef NURBS_BASE_RECURSIVE_EVALUATION
57 int NurbsBase::GetNumKnots()
const {
61 int NurbsBase::GetDegree()
const {
65 int NurbsBase::GetNumCtrlPts()
const {
66 return numCtrlPoints_;
69 double NurbsBase::GetKnot(
int dim,
int index)
const {
70 BIASASSERT(dim >= 0 && dim < (
int)knotVector_.size())
71 BIASASSERT(index >= 0 && index <= knotsPerDim_+1)
72 return knotVector_[dim][index];
75 void NurbsBase::SetKnot(
int dim,
int index,
double value){
76 BIASASSERT(dim >= 0 && dim < (
int)knotVector_.size())
77 BIASASSERT(index >= 0 && index <= knotsPerDim_+1)
78 knotVector_[dim][index] = value;