8 #include <Base/Debug/Error.hh>
10 #include <Base/Math/Vector2.hh>
11 #include <Base/Math/Vector3.hh>
12 #include <Base/Math/Vector4.hh>
13 #include <Base/Geometry/HomgPoint2D.hh>
14 #include <Base/Geometry/HomgPoint3D.hh>
15 #include <Base/Math/Operators.hh>
17 #include "NurbsTemplateInit.hh"
24 template <
class ControlPo
intsT>
40 template <
class ControlPo
intsT>
43 BIASASSERT(nurbsParam >= 0.0 && nurbsParam <= 1.0)
49 double weightSum = 0.0;
52 GetRelevantBaseCtrlPoints(nurbsParam, relevantBegin, relevantEnd);
53 double* baseFuncCache =
new double[degree_+1];
57 for (
int x = relevantBegin; x <= relevantEnd; x++){
58 double weight = BaseFunc(0,x,degree_,nurbsParam,baseFuncCache)* weights_[x];
61 result += (weight * controlPoints_[x]);
64 result = result * (1.0 / weightSum);
66 delete[] baseFuncCache;
70 template <
class ControlPo
intsT>
72 BIASASSERT(index >= 0 && index <= knotsPerDim_+1)
73 return knotVector_[0][index];
76 template <
class ControlPo
intsT>
78 BIASASSERT(index >= 0 && index <= knotsPerDim_+1)
79 knotVector_[0][index] = value;
static void Init(double &value)
void Eval(const double &nurbsParam, ControlPointsT &result) const
Evaluate the NURBS function at a given point in the parameter space.
ControlPointsT * controlPoints_
The array of control points.
Base class for NURBS classes.
void SetKnot(int index, double value)
Set the position of a knot with a given index.
double * weights_
The corresponding weights to the function points.
This class implements a NURBS-function with a one dimensional parameter space (A NURBS line)...
int numCtrlPoints_
The number of control points per dimension.
double GetKnot(int index) const
Returns the position of a knot with a given index.