Kanzi  3.9.4
Kanzi Engine API
kanzi::CurveReparametrization Class Reference

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

Static Public Member Functions

static CurveReparametrizationPtr createEmpty ()
 Creates an empty curve reparametrization. More...
 
static CurveReparametrizationPtr createLinear (float curveLength)
 Creates a linear curve reparametrization by curve length. More...
 
static CurveReparametrizationPtr createSpline (const Spline &spline, unsigned int minimumSamples, unsigned int maximumSubdivisions, float relativeErrorMagnitude)
 Creates a curve length reparametrization for a spline by sampling. More...
 

Protected Member Functions

 CurveReparametrization ()
 Construct CurveReparametrization with member values set to 0. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CurveReparametrization()

kanzi::CurveReparametrization::CurveReparametrization ( )
explicitprotected

Construct CurveReparametrization with member values set to 0.

Member Function Documentation

◆ createEmpty()

static CurveReparametrizationPtr kanzi::CurveReparametrization::createEmpty ( )
static

Creates an empty curve reparametrization.

Returns
CurveReparametrization unique pointer.

◆ createLinear()

static CurveReparametrizationPtr kanzi::CurveReparametrization::createLinear ( float  curveLength)
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.

Parameters
curveLengthLength 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
splineThe spline used for reparametrization.
minimumSamplesMinimum number of samples to sample at.
maximumSubdivisionsMaximum number of subdivisions calculated.
relativeErrorMagnitudeLower 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
lengthParameterCurve 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
phaseParameterPhase 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: