Brick
Loading...
Searching...
No Matches
SplinePath Class Reference

#include <spline_path.h>

Description

Manages multi-segment Hermite spline paths.

Public Types

enum class  Order { Cubic = 3 , Quintic = 5 }
 Order of spline polynomials used per segment. More...

Public Member Functions

 SplinePath ()=default
 Default constructor.
bool empty () const
size_t segment_count () const
double length () const
SplineSample sample_by_s (double s) const
 Samples complete state at arc distance s along the multi-segment path.
std::vector< Translation2d > sample_by_spacing (double ds) const
 Samples 2D positions uniformly spaced by distance ds along the path.
std::vector< Translation2d > sample_by_segment_steps (double steps_per_segment) const
 Samples 2D positions with fixed number of steps per spline segment.

Static Public Member Functions

static SplinePath from_waypoints (const std::vector< HermitePoint > &points, std::function< std::unique_ptr< SplineBase >(const HermitePoint &, const HermitePoint &, double)> factory, double max_err=1e-4)
 Constructs a multi-segment path using a custom Spline factory.
static SplinePath from_hermite (const std::vector< HermitePoint > &points, Order order=Order::Quintic, double max_err=1e-4)
 Constructs a multi-segment path from a vector of Hermite waypoints.

Member Enumeration Documentation

◆ Order

enum class SplinePath::Order
strong

Order of spline polynomials used per segment.

Enumerator
Cubic 

Cubic Hermite splines (C1 continuity).

Quintic 

Quintic Hermite splines (C2 continuity).

Member Function Documentation

◆ empty()

bool SplinePath::empty ( ) const
inline
Returns
True if the path contains no segments.

◆ from_hermite()

SplinePath SplinePath::from_hermite ( const std::vector< HermitePoint > & points,
Order order = Order::Quintic,
double max_err = 1e-4 )
inlinestatic

Constructs a multi-segment path from a vector of Hermite waypoints.

Parameters
pointsHermite waypoints defining path positions, tangents, and optional second derivatives.
orderSpline order (Cubic or Quintic).
max_errMaximum allowable interpolation error in inches for the arc-length lookup table.
Returns
Constructed SplinePath instance.

◆ from_waypoints()

SplinePath SplinePath::from_waypoints ( const std::vector< HermitePoint > & points,
std::function< std::unique_ptr< SplineBase >(const HermitePoint &, const HermitePoint &, double)> factory,
double max_err = 1e-4 )
inlinestatic

Constructs a multi-segment path using a custom Spline factory.

Parameters
pointsBoundary waypoints.
factoryFactory closure producing SplineBase segments.
max_errMaximum allowable interpolation error in inches for the arc-length lookup table.
Returns
Constructed SplinePath instance.

◆ length()

double SplinePath::length ( ) const
inline
Returns
Total arc length of the multi-segment path in inches.

◆ sample_by_s()

SplineSample SplinePath::sample_by_s ( double s) const
inline

Samples complete state at arc distance s along the multi-segment path.

Parameters
sArc distance in inches.
Returns
SplineSample struct containing position, velocity, acceleration, heading, and curvature.

◆ sample_by_segment_steps()

std::vector< Translation2d > SplinePath::sample_by_segment_steps ( double steps_per_segment) const
inline

Samples 2D positions with fixed number of steps per spline segment.

Parameters
steps_per_segmentNumber of steps per segment.
Returns
Vector of 2D translation points.

◆ sample_by_spacing()

std::vector< Translation2d > SplinePath::sample_by_spacing ( double ds) const
inline

Samples 2D positions uniformly spaced by distance ds along the path.

Parameters
dsDistance step in inches.
Returns
Vector of 2D translation points.

◆ segment_count()

size_t SplinePath::segment_count ( ) const
inline
Returns
Number of spline segments in the path.

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