Fits an interpolating spline to the given data points and derivatives.
341 typedef typename SplineType::KnotVectorType::Scalar Scalar;
342 typedef typename SplineType::ControlPointVectorType ControlPointVectorType;
344 typedef Matrix<Scalar, Dynamic, Dynamic>
MatrixType;
346 const DenseIndex n = points.cols() + derivatives.cols();
362 if (derivativeIndices[0] == 0)
364 A.template block<1, 2>(1, 0) << -1, 1;
366 Scalar
y = (knots(degree + 1) - knots(0)) / degree;
367 b.col(1) =
y*derivatives.col(0);
377 if (derivativeIndices[derivatives.cols() - 1] == points.cols() - 1)
379 A.template block<1, 2>(n - 2, n - 2) << -1, 1;
381 Scalar
y = (knots(knots.size() - 1) - knots(knots.size() - (degree + 2))) / degree;
382 b.col(
b.cols() - 2) = y*derivatives.col(derivatives.cols() - 1);
389 const DenseIndex span = SplineType::Span(parameters[i], degree, knots);
391 if (derivativeIndex < derivativeIndices.size() && derivativeIndices[derivativeIndex] == i)
393 A.block(row, span - degree, 2, degree + 1)
394 = SplineType::BasisFunctionDerivatives(parameters[i], 1, degree, knots);
396 b.col(row++) = points.col(i);
397 b.col(row++) = derivatives.col(derivativeIndex++);
401 A.row(row).segment(span - degree, degree + 1)
402 = SplineType::BasisFunctions(parameters[i], degree, knots);
403 b.col(row++) = points.col(i);
406 b.col(0) = points.col(0);
407 b.col(
b.cols() - 1) = points.col(points.cols() - 1);
412 FullPivLU<MatrixType>
lu(A);
413 ControlPointVectorType controlPoints =
lu.solve(
MatrixType(
b.transpose())).transpose();
415 SplineType spline(knots, controlPoints);
RowXpr row(Index i) const
cout<< "Here is the matrix m:"<< endl<< m<< endl;Eigen::FullPivLU< Matrix5x3 > lu(m)
void KnotAveragingWithDerivatives(const ParameterVectorType ¶meters, const unsigned int degree, const IndexArray &derivativeIndices, KnotVectorType &knots)
Computes knot averages when derivative constraints are present. Note that this is a technical interpr...