我正在尝试使用Eigen库创建样条曲线。然而,一旦我创建了一个样条曲线,我不知道如何在给定的点x处得到值。
请参见以下示例及我的意图说明:
#include <Eigen/Core>
#include <unsupported/Eigen/Splines>
int main(int argc, char const* argv[])
{
// points at (0,0) (15,12) and (30,17)
Eigen::MatrixXd points(2, 3);
points << 0, 15, 30,
0, 12, 17;
typedef Eigen::Spline<double, 2> spline2d;
spline2d s = Eigen::SplineFitting<spline2d>::Interpolate(points, 2);
// I now have a spline called s.
// I want to do something like:
double x = 12.34;
double new_y = s(x)[1]; // However this s() function uses a chord value. What is a chord value?
// Is there a:
double new_y2 = s.eval(x)
}
return x;
替换scaled_value
,则s(30)
变为-496.714
而不是17
。 - Wintermute