Easy3D 2.5.3
|
Spline curve fitting for arbitrary dimensions. More...
#include <easy3d/core/spline_curve_fitting.h>
Public Types | |
enum | Node_e { eUNIFORM , eOPEN_UNIFORM } |
typedef Point_t::FT | FT |
Public Member Functions | |
SplineCurveFitting (int k=2, Node_e node_type=eOPEN_UNIFORM) | |
Constructor. More... | |
void | set_ctrl_points (const std::vector< Point_t > &point) |
Sets the position of the spline control points. | |
void | get_ctrl_points (std::vector< Point_t > &points) const |
Gets the control points of the spline. | |
void | set_node_type (Node_e type) |
Sets the the nodal vector type. More... | |
Point_t | eval_f (FT u) const |
Evaluates position of the spline. More... | |
Point_t | eval_df (FT u) const |
Evaluates speed of the spline. | |
int | get_order () const |
std::vector< FT > | get_equally_spaced_parameters (std::size_t steps) const |
Gets parameters such that evaluation of the curve positions using these parameters results in equally spaced points along the curve. More... | |
Spline curve fitting for arbitrary dimensions.
This class uses the efficient blossom algorithm to compute a position on the curve. It allow to set the order of the spline and the end points behavior (passing or not). The class can be instantiated with any point type (1D (float), 2D, 3D etc.) as long as the necessary operator overloads are implemented.
Point_t | type of a point operators such as '+' '*' must be correctly overloaded. The default constructor must be defined to return the null vector (0, 0 ,0 ...) |
FT | floating point representation of the points (float, double etc.) Example usage: const int resolution = 1000; // Number of line subdivisions to display the spline
const int order = 3; // Smoothness of the spline (min 2)
SplineCurveFitting<vec3> fitter(order, SplineCurveFitting<vec3>::eOPEN_UNIFORM);
fitter.set_ctrl_points(points);
for(int i = 0; i < resolution; ++i) {
std::cout << p << std::endl;
}
@ eOPEN_UNIFORM Connected to the first and last control points. Definition: spline_curve_fitting.h:66 |
enum Node_e |
|
explicit |
Constructor.
k | Order of the spline (minimum is two) |
node_type | Nodal vector type (uniform, open_uniform). This will define the behavior of the spline with its control points as well as its speed according to its parameter. |
Point_t eval_f | ( | FT | u | ) | const |
Evaluates position of the spline.
u | : curve parameter ranging from [0; 1]. |
u
will result in non-uniformly distributed points on the curves (because some of input points are closely spaced but others may not). To get points at fixed distances along the curve, use the parameter generated from get_equally_spaced_parameters(). std::vector< typename Point_t::FT > get_equally_spaced_parameters | ( | std::size_t | steps | ) | const |
Gets parameters such that evaluation of the curve positions using these parameters results in equally spaced points along the curve.
Calling eval_f() with equal intervals will result in non-uniformly distributed points on the curves. This method first evaluates the spline curve at equally spaced values in the parameter domain, and then does linear interpolation to compute the parameters that result in points uniformly spaced along the curve.
void set_node_type | ( | Node_e | type | ) |
Sets the the nodal vector type.
The the nodal vector type.