Easy3D 2.5.3
SplineCurveInterpolation< Point_t > Class Template Reference

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 > &parameters, 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
 

Detailed Description

template<typename Point_t>
class easy3d::SplineCurveInterpolation< Point_t >

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.).

Template Parameters
Point_ttype of a point.
Real_tfloating 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) {
const vec3 p = interpolator.eval_f(float(i) / float(resolution - 1));
std::cout << p << std::endl;
}
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition: types.h:45

Constructor & Destructor Documentation

◆ SplineCurveInterpolation()

Constructor.

Sets default boundary conditions to be zero curvature at both ends.

Member Function Documentation

◆ eval_f()

Point_t eval_f ( FT  u) const

Evaluates the position of the spline curve at a given parameter.

Parameters
uCurve parameter in the range [0, 1]. The actual meaning of the parameter is given by the parameters provided in set_points().

◆ set_boundary()

void set_boundary ( BoundaryType  left,
FT  left_value,
BoundaryType  right,
FT  right_value 
)

Sets the boundary condition (optional).

Attention
If called, it has to come before set_points().

◆ set_points() [1/2]

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
parametersThe parameters (e.g., accumulated time or distance) of the points, each corresponding to a point in points.
pointsThe points. Each point corresponds to a parameter in parameters.
cubic_splinetrue for cubic spline interpolation; false for linear interpolation.
Note
The parameters have to be monotonously increasing along the curve.

◆ set_points() [2/2]

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.

Parameters
pointsThe data points. The parameter of each point is its accumulated curve length from the first point.
cubic_splinetrue for cubic spline interpolation; false for linear interpolation.
Note
The points have to be ordered along the curve.

The documentation for this class was generated from the following file: