Kanzi uses curve reparametrization to subdivide a spline or a line into a series of samples. More...
#include <kanzi/core/math/curve_reparametrization.hpp>
Classes | |
struct | ReparametrizationSample |
A sample point (phase, length) for mapping between curve parameter and curve length. More... | |
Public Member Functions | |
float | getCurveLength () const |
Gets the curve length of the curve. Use this to get the total length of the curve reparametrization. | |
float | getLengthParameter (float phaseParameter) |
Gets the curve length that matches the given phase in [0, 1]. | |
float | getLengthSampleByIndex (unsigned int index) const |
Gets length parameter by index. Use this to get the length of a reparametrization sample at given index. | |
float | getPhaseParameter (float lengthParameter) |
Gets the phase that matches the given curve length in [0, length]. | |
unsigned int | getSampleCount () const |
Gets number of sample points a reparametrization uses. | |
Static Public Member Functions | |
static CurveReparametrizationPtr | createEmpty () |
Creates an empty curve reparametrization. | |
static CurveReparametrizationPtr | createLinear (float curveLength) |
Creates a linear curve reparametrization by curve length. | |
static CurveReparametrizationPtr | createSpline (const Spline &spline, unsigned int minimumSamples, unsigned int maximumSubdivisions, float relativeErrorMagnitude) |
Creates a curve length reparametrization for a spline by sampling. | |
Protected Member Functions | |
CurveReparametrization () | |
Construct CurveReparametrization with member values set to 0. | |
Kanzi uses curve reparametrization to subdivide a spline or a line into a series of samples.
Use this class to split a spline into more points, or to create a linear range of points from 0 to curveLength. You can query the sample points by the phase (or time) or length parameters, using getPhaseParameter() or getLengthParameter(). These methods return a sample point defined at the phase coordinate or at the curve length coordinate.
|
explicitprotected |
Construct CurveReparametrization with member values set to 0.
|
static |
Creates an empty curve reparametrization.
|
static |
Creates a linear curve reparametrization by curve length.
Use this to subdivide a linear path into multiple steps. This reparametrization only contains two samples, one at phase 0, and another at curve length.
curveLength | Length of the curve. |
|
static |
Creates a curve length reparametrization for a spline by sampling.
Use this to subdivide a spline into more smooth representation. First splits the curve into secant lines by sampling at 'minimumSamples' points. After that subdivides the secants as long as the relative error estimate is over 'relativeErrorMagnitude' and 'maximumSubdivisions' depth is not reached.
spline | The spline used for reparametrization. |
minimumSamples | Minimum number of samples to sample at. |
maximumSubdivisions | Maximum number of subdivisions calculated. |
relativeErrorMagnitude | Lower limit for relative error estimate. |
Gets the phase that matches the given curve length in [0, length].
Use this to evaluate a curve reparametrization at given phase, or time.
lengthParameter | Curve length parameter. |
Gets the curve length that matches the given phase in [0, 1].
Use this to get the length of the curve at a given phase, or time.
phaseParameter | Phase parameter. |
float kanzi::CurveReparametrization::getCurveLength | ( | ) | const |
Gets the curve length of the curve. Use this to get the total length of the curve reparametrization.
Gets number of sample points a reparametrization uses.
Use this to get how many discrete samples, or points, the curve reparametrization has. Can in some cases be used as an approximation for complexity of the curve.
Gets length parameter by index. Use this to get the length of a reparametrization sample at given index.