NDEVR
API Documentation
Path

A monotone cubic Hermite spline path that interpolates values over time. More...

Collaboration diagram for Path:
[legend]

Public Member Functions

 Path ()
 Default constructor.
 Path (const Buffer< Time > &time, const Buffer< fltp04 > &y, const Buffer< fltp04 > &m)
 Constructs a Path from pre-computed time, value, and tangent buffers.
 Path (const Path &&path)
 Move constructor.
 Path (const Path &path)
 Copy constructor.
fltp08 interpolateX (const Time &current_time)
 Interpolates the path value at a given time using cubic Hermite spline interpolation.
Pathoperator= (const Path &path)
 Copy assignment operator.

Static Public Member Functions

static Path createMonotoneAngleCubicPathSorted (const Buffer< Time > &time, const Buffer< Angle< fltp08 > > &y)
 Creates a monotone cubic angle path after sorting the control points by time in descending order.
static Path createMonotoneCubicPath (const Buffer< Time > &time, const Buffer< fltp04 > &y)
 Creates a monotone cubic Hermite spline path from time-value control points.
static Path createMonotoneCubicPathAzimuth (const Buffer< Time > &time, const Buffer< Angle< fltp08 > > &y)
 Creates a monotone cubic Hermite spline path for azimuth (angular) values over time.
static Path createMonotoneCubicPathSorted (const Buffer< Time > &time, const Buffer< fltp04 > &y)
 Creates a monotone cubic path after sorting the control points by time in descending order.

Protected Attributes

Buffer< fltp04mM
 The tangent (slope) values at each control point, used for Hermite interpolation.
Buffer< TimemX
 The time values (X-axis) for each control point.
Buffer< fltp04mY
 The interpolated values (Y-axis) at each control point.

Detailed Description

A monotone cubic Hermite spline path that interpolates values over time.


Provides functionality to create and evaluate piecewise cubic Hermite interpolating polynomials from a set of time-value control points. The interpolation preserves monotonicity of the data, meaning it will not introduce spurious oscillations between data points. This is commonly used for smooth camera or object animation paths.

Definition at line 46 of file TimePath.h.

Constructor & Destructor Documentation

◆ Path() [1/4]

Path::Path ( )
inline

Default constructor.


Creates an empty path with no control points.

Definition at line 52 of file TimePath.h.

Referenced by Path(), Path(), createMonotoneAngleCubicPathSorted(), createMonotoneCubicPath(), createMonotoneCubicPathAzimuth(), createMonotoneCubicPathSorted(), and operator=().

◆ Path() [2/4]

Path::Path ( const Buffer< Time > & time,
const Buffer< fltp04 > & y,
const Buffer< fltp04 > & m )
inline

Constructs a Path from pre-computed time, value, and tangent buffers.


Parameters
[in]timeThe time values for each control point.
[in]yThe interpolated values at each control point.
[in]mThe tangent (slope) values at each control point.

Definition at line 61 of file TimePath.h.

References mM, mX, and mY.

◆ Path() [3/4]

Path::Path ( const Path & path)
inline

Copy constructor.


Parameters
[in]pathThe Path to copy from.

Definition at line 71 of file TimePath.h.

References Path(), mM, mX, and mY.

◆ Path() [4/4]

Path::Path ( const Path && path)
inline

Move constructor.


Parameters
[in]pathThe Path to move from.

Definition at line 81 of file TimePath.h.

References Path(), mM, mX, and mY.

Member Function Documentation

◆ createMonotoneAngleCubicPathSorted()

Path Path::createMonotoneAngleCubicPathSorted ( const Buffer< Time > & time,
const Buffer< Angle< fltp08 > > & y )
inlinestatic

Creates a monotone cubic angle path after sorting the control points by time in descending order.


Sorts the time-angle pairs so that time values are in descending order, then constructs a monotone cubic spline that handles azimuth wraparound.

Note
Uses the same descending sort order as createMonotoneCubicPathSorted. See note there.
Parameters
[in]timeThe unsorted time values for each control point.
[in]yThe azimuth angle values at each control point.
Returns
A Path constructed from the sorted control points with azimuth wraparound handling.

Definition at line 285 of file TimePath.h.

References Path(), Buffer< t_type, t_memory_manager >::add(), and createMonotoneCubicPathAzimuth().

◆ createMonotoneCubicPath()

Path Path::createMonotoneCubicPath ( const Buffer< Time > & time,
const Buffer< fltp04 > & y )
inlinestatic

Creates a monotone cubic Hermite spline path from time-value control points.


Constructs a Path whose spline interpolation preserves the monotonicity of the input data. The Fritsch-Carlson method is used to compute tangents that prevent overshooting between data points. The time values must be strictly increasing.

Parameters
[in]timeThe strictly increasing time values for each control point.
[in]yThe values at each control point.
Returns
A Path configured for monotone cubic Hermite interpolation.
Exceptions
Exceptionif fewer than two control points are provided, or if arrays differ in size, or if time values are not strictly increasing.

Definition at line 140 of file TimePath.h.

References Path(), cast(), and hypot().

Referenced by createMonotoneCubicPathAzimuth(), and createMonotoneCubicPathSorted().

◆ createMonotoneCubicPathAzimuth()

Path Path::createMonotoneCubicPathAzimuth ( const Buffer< Time > & time,
const Buffer< Angle< fltp08 > > & y )
inlinestatic

Creates a monotone cubic Hermite spline path for azimuth (angular) values over time.


Handles the wraparound discontinuity at +/-180 degrees by inserting intermediate control points near the boundary. This prevents the spline from interpolating the long way around when crossing the +/-180 degree seam.

Note
Both conditional blocks on lines checking (y[i] - y[i+1]) > 180.0 appear to use the same comparison (> 180.0). The second block may have been intended to check < -180.0 to handle wraparound in the opposite direction. This looks like a potential bug.
Parameters
[in]timeThe time values for each control point.
[in]yThe azimuth angle values at each control point.
Returns
A Path configured for monotone cubic interpolation of azimuth angles.
Exceptions
Exceptionif fewer than two control points are provided or arrays differ in size.

Definition at line 208 of file TimePath.h.

References Path(), Buffer< t_type, t_memory_manager >::add(), cast(), and createMonotoneCubicPath().

Referenced by createMonotoneAngleCubicPathSorted(), and MovementPath::setAngleChannel().

◆ createMonotoneCubicPathSorted()

Path Path::createMonotoneCubicPathSorted ( const Buffer< Time > & time,
const Buffer< fltp04 > & y )
inlinestatic

Creates a monotone cubic path after sorting the control points by time in descending order.


Sorts the time-value pairs so that time values are in descending order before constructing the monotone cubic spline. Useful when control points are not provided in chronological order.

Note
The sort uses descending order (greater-than comparison), which may be intentional for reverse-time interpolation, but could also be unintended since createMonotoneCubicPath expects strictly increasing time values.
Parameters
[in]timeThe unsorted time values for each control point.
[in]yThe values at each control point, corresponding to the time values.
Returns
A Path constructed from the sorted control points.

Definition at line 252 of file TimePath.h.

References Path(), Buffer< t_type, t_memory_manager >::add(), and createMonotoneCubicPath().

Referenced by MovementPath::setPositionChannel().

◆ interpolateX()

fltp08 Path::interpolateX ( const Time & current_time)
inline

Interpolates the path value at a given time using cubic Hermite spline interpolation.


Evaluates the monotone cubic Hermite spline at the specified time. If the time is before the first control point, the first value is returned. If after the last, the last value is returned. Returns Constant<fltp08>::Invalid if the time is invalid or the path is empty.

Parameters
[in]current_timeThe time at which to evaluate the interpolated value.
Returns
The interpolated value at the given time, or Constant<fltp08>::Invalid if the path is empty or the time is invalid.

Definition at line 98 of file TimePath.h.

References IsInvalid(), mM, mX, and mY.

◆ operator=()

Path & Path::operator= ( const Path & path)
inline

Copy assignment operator.


Parameters
[in]pathThe Path to copy from.
Returns
A reference to this Path after assignment.

Definition at line 311 of file TimePath.h.

References Path(), mM, mX, and mY.


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