Kanzi uses curve reparametrization to subdivide a spline or a line into a series of samples.
More...
#include <kanzi/core/math/curve_reparametrization.hpp>
|
float | getCurveLength () const |
| Gets the curve length of the curve. Use this to get the total length of the curve reparametrization. More...
|
|
float | getLengthParameter (float phaseParameter) |
| Gets the curve length that matches the given phase in [0, 1]. More...
|
|
float | getLengthSampleByIndex (unsigned int index) const |
| Gets length parameter by index. Use this to get the length of a reparametrization sample at given index. More...
|
|
float | getPhaseParameter (float lengthParameter) |
| Gets the phase that matches the given curve length in [0, length]. More...
|
|
unsigned int | getSampleCount () const |
| Gets number of sample points a reparametrization uses. More...
|
|
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.
◆ CurveReparametrization()
kanzi::CurveReparametrization::CurveReparametrization |
( |
| ) |
|
|
explicitprotected |
◆ createEmpty()
◆ createLinear()
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.
- Parameters
-
curveLength | Length of the curve. |
- Returns
- CurveReparametrization unique pointer.
◆ createSpline()
static CurveReparametrizationPtr kanzi::CurveReparametrization::createSpline |
( |
const Spline & |
spline, |
|
|
unsigned int |
minimumSamples, |
|
|
unsigned int |
maximumSubdivisions, |
|
|
float |
relativeErrorMagnitude |
|
) |
| |
|
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.
- Parameters
-
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. |
- Returns
- CurveReparametrization unique pointer.
◆ getPhaseParameter()
float kanzi::CurveReparametrization::getPhaseParameter |
( |
float |
lengthParameter | ) |
|
Gets the phase that matches the given curve length in [0, length].
Use this to evaluate a curve reparametrization at given phase, or time.
- Parameters
-
lengthParameter | Curve length parameter. |
- Returns
- The phase for the given curve length.
◆ getLengthParameter()
float kanzi::CurveReparametrization::getLengthParameter |
( |
float |
phaseParameter | ) |
|
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.
- Parameters
-
phaseParameter | Phase parameter. |
- Returns
- The curve length for the given phase.
◆ getCurveLength()
float kanzi::CurveReparametrization::getCurveLength |
( |
| ) |
const |
Gets the curve length of the curve. Use this to get the total length of the curve reparametrization.
◆ getSampleCount()
unsigned int kanzi::CurveReparametrization::getSampleCount |
( |
| ) |
const |
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.
◆ getLengthSampleByIndex()
float kanzi::CurveReparametrization::getLengthSampleByIndex |
( |
unsigned int |
index | ) |
const |
Gets length parameter by index. Use this to get the length of a reparametrization sample at given index.
The documentation for this class was generated from the following file: