From b1169ce40cf615ec2cd8eb116ae905b48a849a3a Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 10 Jul 2014 12:03:42 -0600 Subject: [PATCH] Fixed index that would cause crash with two point, two derivative interpolation. Added static_cast. --- unsupported/Eigen/src/Splines/SplineFitting.h | 2 +- unsupported/test/splines.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unsupported/Eigen/src/Splines/SplineFitting.h b/unsupported/Eigen/src/Splines/SplineFitting.h index 85de38b257..d3c245fa99 100644 --- a/unsupported/Eigen/src/Splines/SplineFitting.h +++ b/unsupported/Eigen/src/Splines/SplineFitting.h @@ -128,7 +128,7 @@ namespace Eigen newKnotIndex = -1; - ParameterVectorType temporaryParameters(numParameters); + ParameterVectorType temporaryParameters(numParameters + 1); KnotVectorType derivativeKnots(numInternalDerivatives); for (unsigned int i = 0; i < numAverageKnots - 1; ++i) { diff --git a/unsupported/test/splines.cpp b/unsupported/test/splines.cpp index 0b43eefb82..97665af969 100644 --- a/unsupported/test/splines.cpp +++ b/unsupported/test/splines.cpp @@ -252,7 +252,7 @@ void check_global_interpolation_with_derivatives2d() VectorXd derivativeIndices(numPoints); for (Eigen::DenseIndex i = 0; i < numPoints; ++i) - derivativeIndices(i) = i; + derivativeIndices(i) = static_cast(i); const Spline2d spline = SplineFitting::InterpolateWithDerivatives( points, derivatives, derivativeIndices, degree);