26 #include "BSplineCurve.hh"
27 #include <Base/Common/BIASpragma.hh>
34 initializedQuadratic_=
false;
35 initializedCubic_=
false;
43 BIASERR(
"BSpline: no control points given - call ");
44 BIASERR(
"SetControlPoints(cPnts)!\r\n");
48 BIASERR(
"BSpline: less then 3 control points given - call ");
49 BIASERR(
"SetControlPoints(cPnts) with 3 or more control points!\r\n");
75 for(
unsigned int i=0; i<cPnts_.size()-2; i++){
76 for(
unsigned int j=0; j<3;j++){
77 xTmp[j]=cPnts_[i+j][0];
78 yTmp[j]=cPnts_[i+j][1];
81 coeffM.
Mult(xTmp, xItem);
82 coeffM.
Mult(yTmp, yItem);
83 xCoeff_.push_back(xItem);
84 yCoeff_.push_back(yItem);
87 initializedQuadratic_=
true;
88 initializedCubic_=
false;
97 BIASERR(
"BSpline: no control points given - call ");
98 BIASERR(
"SetControlPoints(cPnts)!\r\n");
102 BIASERR(
"BSpline: less then 4 control points given - call ")
103 BIASERR(
"SetControlPoints(cPnts) with 4 or more control points!\r\n");
135 for(
unsigned int i=0; i<cPnts_.size()-3;i++){
136 for(
unsigned int j=0; j<4; j++){
137 xTmp[j]=cPnts_[i+j][0];
138 yTmp[j]=cPnts_[i+j][1];
140 coeffM.
Mult(xTmp,xItem);
141 coeffM.
Mult(yTmp,yItem);
142 xCoeff_.push_back(xItem);
143 yCoeff_.push_back(yItem);
146 initializedCubic_=
true;
147 initializedQuadratic_=
false;
154 if(!initializedQuadratic_){
155 BIASERR(
"BSpline: call InitQuadraticUniformBSpline() at first!\r\n");
159 unsigned int actSegment;
166 actSegment=cPnts_.size()-3;
169 actSegment= (
unsigned int)(t * (
double)(cPnts_.size()-2));
170 t= t* (double)(cPnts_.size()-2) - (
double) actSegment;
184 if(!initializedCubic_){
185 BIASERR(
"BSpline: call InitCubicUniformBSpline() at first!\r\n");
189 unsigned int actSegment;
196 actSegment=cPnts_.size()-4;
199 actSegment= (
unsigned int) (t * (
double)(cPnts_.size()-3));
200 t= t * (double)(cPnts_.size()-3) - (
double) actSegment;
T ScalarProduct(const Vector< T > &argvec) const
scalar product (inner product) of two vectors returning a scalr
void InitQuadraticUniformBSpline()
computes coefficients for all segments of a quadratic uniform B-spline
void CubicUniformBSpline(Vector2< double > &res, double t)
computes the point on a cubic uniform B-spline curve at time t
virtual void clear()
stl conform interface destroys Matrix JW
void InitCubicUniformBSpline()
computes coefficients for all segments of a cubic uniform B-spline
void Mult(const Matrix< T > &arg, Matrix< T > &result) const
matrix multiplication, result is not allocated
void QuadraticUniformBSpline(Vector2< double > &res, double t)
computes the point on a quadratic uniform B-spline curve at time t