RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::ParametricPath Class Referenceabstract

Differentiable 2D path over a unit-interval parameter t ∈ [0, 1]. More...

#include <ParametricPath.hpp>

Inheritance diagram for rz::ParametricPath:
rz::CubicBezier rz::PiecewiseCubicBezier

Public Member Functions

virtual ~ParametricPath ()=default
 Virtual destructor.
virtual Point getPoint (double t) const noexcept=0
 Position on the path at parameter t.
virtual Point getVelocity (double t) const noexcept=0
 First derivative dP/dt at parameter t (w.r.t. path parameter).
virtual Point getAcceleration (double t) const noexcept=0
 Second derivative d²P/dt² at parameter t (w.r.t. path parameter).
virtual Angle getTheta (double t) const noexcept
 Path heading: orientation of the tangent dP/dt.
virtual Curvature getCurvature (double t) const noexcept
 Signed curvature κ(t) = wedge(dP/dt, d²P/dt²) / |dP/dt|³.
virtual Length getLength (double tStart=0, double tEnd=1) const noexcept
 Arclength along the path between parameters tStart and tEnd.
virtual double stepT (double t, Length distance) const noexcept
 Advance the parameter by a target arclength measured along the path.
virtual DiscretePath toDiscrete (Length distance, bool includeEnd=true) const

Detailed Description

Differentiable 2D path over a unit-interval parameter t ∈ [0, 1].

Implementers provide position and its first two derivatives with respect to the dimensionless path parameter t. Higher-level queries—heading, curvature, arclength, parameter stepping by distance, and discretization—are derived here.

Units & semantics

  • getPoint(t) → position in meters (Point stores meter-valued components).
  • getVelocity(t) → dP/dt in meters (derivative w.r.t. parameter, not time).
  • getAcceleration(t) → d²P/dt² in meters (w.r.t. parameter).
  • getTheta(t) → heading of the tangent (radians).
  • getCurvature(t) → signed curvature κ = wedge(dP/dt, d²P/dt²) / |dP/dt|³ (1/meters).
  • getLength(a,b) → ∫_a^b |dP/dt| dt (meters).

Domain: All functions expect 0 ≤ t ≤ 1 (implementations may clamp internally).

Continuity: For stable curvature, the path should be at least C¹ and piecewise C².

Constructor & Destructor Documentation

◆ ~ParametricPath()

virtual rz::ParametricPath::~ParametricPath ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ getAcceleration()

virtual Point rz::ParametricPath::getAcceleration ( double t) const
pure virtualnoexcept

Second derivative d²P/dt² at parameter t (w.r.t. path parameter).

Parameters
tDimensionless parameter.
Returns
Second derivative vector; components in meters.
Precondition
0 ≤ t ≤ 1.

Implemented in rz::CubicBezier, and rz::PiecewiseCubicBezier.

◆ getCurvature()

virtual Curvature rz::ParametricPath::getCurvature ( double t) const
virtualnoexcept

Signed curvature κ(t) = wedge(dP/dt, d²P/dt²) / |dP/dt|³.

Positive for left-turning, negative for right-turning (right-handed coordinates).

Parameters
tDimensionless parameter.
Returns
Curvature in 1/meters.
Precondition
0 ≤ t ≤ 1.
Note
Returns 0 when |dP/dt| is ~0 to avoid division by zero.

◆ getLength()

virtual Length rz::ParametricPath::getLength ( double tStart = 0,
double tEnd = 1 ) const
virtualnoexcept

Arclength along the path between parameters tStart and tEnd.

Computes s = ∫_{tStart}^{tEnd} |dP/dt| dt using adaptive Gauss–Legendre quadrature. https://en.wikipedia.org/wiki/Adaptive_quadrature

Parameters
tStartStart parameter (default 0).
tEndEnd parameter (default 1).
Returns
Length in meters.
Precondition
0 ≤ tStart ≤ tEnd ≤ 1.

◆ getPoint()

virtual Point rz::ParametricPath::getPoint ( double t) const
pure virtualnoexcept

Position on the path at parameter t.

Parameters
tDimensionless parameter, typically in [0, 1].
Returns
2D point in meters.
Precondition
0 ≤ t ≤ 1.

Implemented in rz::CubicBezier, and rz::PiecewiseCubicBezier.

◆ getTheta()

virtual Angle rz::ParametricPath::getTheta ( double t) const
virtualnoexcept

Path heading: orientation of the tangent dP/dt.

Equivalent to atan2(dy/dt, dx/dt) via Point::theta().

Parameters
tDimensionless parameter.
Returns
Heading angle in radians.
Precondition
0 ≤ t ≤ 1.
Note
Returns 0 when |dP/dt| ≈ 0 (stationary/cusp).

◆ getVelocity()

virtual Point rz::ParametricPath::getVelocity ( double t) const
pure virtualnoexcept

First derivative dP/dt at parameter t (w.r.t. path parameter).

Parameters
tDimensionless parameter.
Returns
Tangent vector; magnitude has units of meters.
Note
This is not velocity w.r.t. physical time.
Precondition
0 ≤ t ≤ 1.

Implemented in rz::CubicBezier, and rz::PiecewiseCubicBezier.

◆ stepT()

virtual double rz::ParametricPath::stepT ( double t,
Length distance ) const
virtualnoexcept

Advance the parameter by a target arclength measured along the path.

Finds t' ≥ t such that ∫_{t}^{t'} |dP/dt| dt ≈ distance. Uses a safeguarded Newton/bisection refinement with bracketing and clamps to t' ≤ 1. https://discourse.julialang.org/t/references-and-implementation-for-safe-hybrid-univariate-newtons-method/87638

Parameters
tCurrent parameter in [0, 1].
distanceDesired arclength step (meters), s ≥ 0.
Returns
Next parameter t' ∈ [t, 1].
Note
If distance == 0 or t == 1, returns 1.

◆ toDiscrete()

virtual DiscretePath rz::ParametricPath::toDiscrete ( Length distance,
bool includeEnd = true ) const
virtual

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