IndexArray is now a typename.

Changed interpolate with derivatives test to use VERIFY_IS_APPROX.
This commit is contained in:
Jeff 2014-06-25 19:02:57 -06:00
parent f9496d341f
commit 08c615f1e4
3 changed files with 16 additions and 15 deletions

View File

@ -74,7 +74,7 @@ namespace Eigen
* Curve interpolation with directional constraints for engineering design. * Curve interpolation with directional constraints for engineering design.
* Engineering with Computers * Engineering with Computers
**/ **/
template <typename KnotVectorType, typename ParameterVectorType> template <typename KnotVectorType, typename ParameterVectorType, typename IndexArray>
void KnotAveragingWithDerivatives(const ParameterVectorType& parameters, void KnotAveragingWithDerivatives(const ParameterVectorType& parameters,
const unsigned int degree, const unsigned int degree,
const IndexArray& derivativeIndices, const IndexArray& derivativeIndices,
@ -255,7 +255,7 @@ namespace Eigen
* Curve interpolation with directional constraints for engineering design. * Curve interpolation with directional constraints for engineering design.
* Engineering with Computers * Engineering with Computers
**/ **/
template <typename PointArrayType> template <typename PointArrayType, typename IndexArray>
static SplineType InterpolateWithDerivatives(const PointArrayType& points, static SplineType InterpolateWithDerivatives(const PointArrayType& points,
const PointArrayType& derivatives, const PointArrayType& derivatives,
const IndexArray& derivativeIndices, const IndexArray& derivativeIndices,
@ -277,7 +277,7 @@ namespace Eigen
* Curve interpolation with directional constraints for engineering design. * Curve interpolation with directional constraints for engineering design.
* Engineering with Computers * Engineering with Computers
*/ */
template <typename PointArrayType> template <typename PointArrayType, typename IndexArray>
static SplineType InterpolateWithDerivatives(const PointArrayType& points, static SplineType InterpolateWithDerivatives(const PointArrayType& points,
const PointArrayType& derivatives, const PointArrayType& derivatives,
const IndexArray& derivativeIndices, const IndexArray& derivativeIndices,
@ -327,7 +327,7 @@ namespace Eigen
} }
template <typename SplineType> template <typename SplineType>
template <typename PointArrayType> template <typename PointArrayType, typename IndexArray>
SplineType SplineType
SplineFitting<SplineType>::InterpolateWithDerivatives(const PointArrayType& points, SplineFitting<SplineType>::InterpolateWithDerivatives(const PointArrayType& points,
const PointArrayType& derivatives, const PointArrayType& derivatives,
@ -414,7 +414,7 @@ namespace Eigen
} }
template <typename SplineType> template <typename SplineType>
template <typename PointArrayType> template <typename PointArrayType, typename IndexArray>
SplineType SplineType
SplineFitting<SplineType>::InterpolateWithDerivatives(const PointArrayType& points, SplineFitting<SplineType>::InterpolateWithDerivatives(const PointArrayType& points,
const PointArrayType& derivatives, const PointArrayType& derivatives,

View File

@ -88,8 +88,6 @@ namespace Eigen
/** \brief 3D double B-spline with dynamic degree. */ /** \brief 3D double B-spline with dynamic degree. */
typedef Spline<double,3> Spline3d; typedef Spline<double,3> Spline3d;
typedef Array<DenseIndex, 1, Dynamic> IndexArray;
} }
#endif // EIGEN_SPLINES_FWD_H #endif // EIGEN_SPLINES_FWD_H

View File

@ -249,7 +249,7 @@ void check_global_interpolation_with_derivatives2d()
Eigen::ChordLengths(points, knots); Eigen::ChordLengths(points, knots);
ArrayXXd derivatives = ArrayXXd::Random(dimension, numPoints); ArrayXXd derivatives = ArrayXXd::Random(dimension, numPoints);
Eigen::IndexArray derivativeIndices(numPoints); VectorXd derivativeIndices(numPoints);
for (Eigen::DenseIndex i = 0; i < numPoints; ++i) for (Eigen::DenseIndex i = 0; i < numPoints; ++i)
derivativeIndices(i) = i; derivativeIndices(i) = i;
@ -261,18 +261,21 @@ void check_global_interpolation_with_derivatives2d()
{ {
PointType point = spline(knots(i)); PointType point = spline(knots(i));
PointType referencePoint = points.col(i); PointType referencePoint = points.col(i);
VERIFY((point - referencePoint).matrix().norm() < 1e-10); VERIFY_IS_APPROX(point, referencePoint);
PointType derivative = spline.derivatives(knots(i), 1).col(1); PointType derivative = spline.derivatives(knots(i), 1).col(1);
PointType referenceDerivative = derivatives.col(i); PointType referenceDerivative = derivatives.col(i);
VERIFY((derivative - referenceDerivative).matrix().norm() < 1e-10); VERIFY_IS_APPROX(derivative, referenceDerivative);
} }
} }
void test_splines() void test_splines()
{ {
CALL_SUBTEST( eval_spline3d() ); for (int i = 0; i < g_repeat; ++i)
CALL_SUBTEST( eval_spline3d_onbrks() ); {
CALL_SUBTEST( eval_closed_spline2d() ); CALL_SUBTEST( eval_spline3d() );
CALL_SUBTEST( check_global_interpolation2d() ); CALL_SUBTEST( eval_spline3d_onbrks() );
CALL_SUBTEST( check_global_interpolation_with_derivatives2d() ); CALL_SUBTEST( eval_closed_spline2d() );
CALL_SUBTEST( check_global_interpolation2d() );
CALL_SUBTEST( check_global_interpolation_with_derivatives2d() );
}
} }