Easy3D 2.5.3
|
Cubic spline curve interpolation for arbitrary dimensions. More...
#include <easy3d/core/spline_curve_interpolation.h>
Public Types | |
enum | BoundaryType { first_deriv = 1 , second_deriv = 2 } |
typedef Point_t::FT | FT |
Public Member Functions | |
SplineCurveInterpolation () | |
void | set_boundary (BoundaryType left, FT left_value, BoundaryType right, FT right_value) |
void | set_points (const std::vector< FT > ¶meters, const std::vector< Point_t > &points, bool cubic_spline=true) |
void | set_points (const std::vector< Point_t > &points, bool cubic_spline=true) |
This is an overload of the set_points() function. The parameters are the accumulated curve length. More... | |
Point_t | eval_f (FT u) const |
Cubic spline curve interpolation for arbitrary dimensions.
This is a wrapper of SplineInterpolation. It can be instantiated with any point type (1D, 2D, 3D etc.).
Point_t | type of a point. |
Real_t | floating point representation of the points (float, double etc.) Example usage: const int resolution = 1000; // Number of line subdivisions to display the spline
SplineCurveInterpolation<vec3> interpolator;
interpolator.set_boundary(...);
interpolator.set_points(points);
for (int i = 0; i < resolution; ++i) {
std::cout << p << std::endl;
}
|
|
inline |
Constructor.
Sets default boundary conditions to be zero curvature at both ends.
Point_t eval_f | ( | FT | u | ) | const |
Evaluates the position of the spline curve at a given parameter.
u | Curve parameter in the range [0, 1]. The actual meaning of the parameter is given by the parameters provided in set_points(). |
void set_boundary | ( | BoundaryType | left, |
FT | left_value, | ||
BoundaryType | right, | ||
FT | right_value | ||
) |
Sets the boundary condition (optional).
void set_points | ( | const std::vector< FT > & | parameters, |
const std::vector< Point_t > & | points, | ||
bool | cubic_spline = true |
||
) |
Sets the parameters and position of the point samples on the curve.
parameters | The parameters (e.g., accumulated time or distance) of the points, each corresponding to a point in points . |
points | The points. Each point corresponds to a parameter in parameters . |
cubic_spline | true for cubic spline interpolation; false for linear interpolation. |
parameters
have to be monotonously increasing along the curve. void set_points | ( | const std::vector< Point_t > & | points, |
bool | cubic_spline = true |
||
) |
This is an overload of the set_points() function. The parameters are the accumulated curve length.
Sets the position of the point samples on the curve.
points | The data points. The parameter of each point is its accumulated curve length from the first point. |
cubic_spline | true for cubic spline interpolation; false for linear interpolation. |
points
have to be ordered along the curve.