aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/splines.cpp
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2012-04-13 12:50:05 +0200
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2012-04-13 12:50:05 +0200
commit84c93b048ecab7c22291503e68c47b6e3264fbb0 (patch)
treedc7cd508b4442aed6d45147b82e8f364bb8ed34a /unsupported/test/splines.cpp
parentf6a55083922dce680f6f89a18e0cc35406201571 (diff)
Added spline interpolation with pre-defined knot parameters.
Diffstat (limited to 'unsupported/test/splines.cpp')
-rw-r--r--unsupported/test/splines.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/unsupported/test/splines.cpp b/unsupported/test/splines.cpp
index 02e170c44..fe98bf183 100644
--- a/unsupported/test/splines.cpp
+++ b/unsupported/test/splines.cpp
@@ -216,16 +216,32 @@ void check_global_interpolation2d()
typedef Spline2d::ControlPointVectorType ControlPointVectorType;
ControlPointVectorType points = ControlPointVectorType::Random(2,100);
- const Spline2d spline = SplineFitting<Spline2d>::Interpolate(points,3);
KnotVectorType chord_lengths; // knot parameters
Eigen::ChordLengths(points, chord_lengths);
- for (Eigen::DenseIndex i=0; i<points.cols(); ++i)
+ // interpolation without knot parameters
{
- PointType pt = spline( chord_lengths(i) );
- PointType ref = points.col(i);
- VERIFY( (pt - ref).matrix().norm() < 1e-14 );
+ const Spline2d spline = SplineFitting<Spline2d>::Interpolate(points,3);
+
+ for (Eigen::DenseIndex i=0; i<points.cols(); ++i)
+ {
+ PointType pt = spline( chord_lengths(i) );
+ PointType ref = points.col(i);
+ VERIFY( (pt - ref).matrix().norm() < 1e-14 );
+ }
+ }
+
+ // interpolation with given knot parameters
+ {
+ const Spline2d spline = SplineFitting<Spline2d>::Interpolate(points,3,chord_lengths);
+
+ for (Eigen::DenseIndex i=0; i<points.cols(); ++i)
+ {
+ PointType pt = spline( chord_lengths(i) );
+ PointType ref = points.col(i);
+ VERIFY( (pt - ref).matrix().norm() < 1e-14 );
+ }
}
}