diff options
author | Hauke Heibel <hauke.heibel@gmail.com> | 2012-07-28 13:37:29 +0200 |
---|---|---|
committer | Hauke Heibel <hauke.heibel@gmail.com> | 2012-07-28 13:37:29 +0200 |
commit | 52a0e0d65e4a638beabd54437846f9746ba87a50 (patch) | |
tree | 6c37594d6404e3ee957948000f7d5d2edfba8e18 /unsupported/Eigen/src/Splines | |
parent | f23dd7c6f1b7b0e6d9cc98ee25e23c1b434e3381 (diff) |
Added a default constructor for Splines which creates zero (constant) splines.
Diffstat (limited to 'unsupported/Eigen/src/Splines')
-rw-r--r-- | unsupported/Eigen/src/Splines/Spline.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/unsupported/Eigen/src/Splines/Spline.h b/unsupported/Eigen/src/Splines/Spline.h index 3680f013a..74048834a 100644 --- a/unsupported/Eigen/src/Splines/Spline.h +++ b/unsupported/Eigen/src/Splines/Spline.h @@ -50,6 +50,21 @@ namespace Eigen /** \brief The data type representing the spline's control points. */ typedef typename SplineTraits<Spline>::ControlPointVectorType ControlPointVectorType; + + /** + * \brief Creates a (constant) zero spline. + * For Splines with dynamic degree, the resulting degree will be 0. + **/ + Spline() + : m_knots(1, (Degree==Dynamic ? 2 : 2*Degree+2)) + , m_ctrls(ControlPointVectorType::Zero(2,(Degree==Dynamic ? 1 : Degree+1))) + { + // in theory this code can go to the initializer list but it will get pretty + // much unreadable ... + enum { MinDegree = (Degree==Dynamic ? 0 : Degree) }; + m_knots.template segment<MinDegree+1>(0) = Array<Scalar,1,MinDegree+1>::Zero(); + m_knots.template segment<MinDegree+1>(MinDegree+1) = Array<Scalar,1,MinDegree+1>::Ones(); + } /** * \brief Creates a spline from a knot vector and control points. |