From 52a0e0d65e4a638beabd54437846f9746ba87a50 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Sat, 28 Jul 2012 13:37:29 +0200 Subject: [PATCH] Added a default constructor for Splines which creates zero (constant) splines. --- unsupported/Eigen/src/Splines/Spline.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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::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(0) = Array::Zero(); + m_knots.template segment(MinDegree+1) = Array::Ones(); + } /** * \brief Creates a spline from a knot vector and control points.