Class CubicSpline2d

Class Documentation

class CubicSpline2d

Public Functions

CubicSpline2d()

Default constructor for CubicSpline2d. Initializes an empty 2D spline.

void initialize(const std::vector<float> &x, const std::vector<float> &y)

Initializes the 2D spline with the given x and y coordinates.

Parameters:
  • x – Vector of x coordinates.

  • y – Vector of y coordinates.

std::pair<float, float> calc_position(float s)

Computes the (x, y) position at a given s along the spline.

Parameters:

s – The arc length parameter.

Returns:

Pair of (x, y) position.

std::tuple<float, float> calc_curvature_and_yaw(float s)

Calculates curvature and yaw (heading angle) at a given s.

Parameters:

s – The arc length parameter.

Returns:

Tuple of (curvature, yaw angle).

std::tuple<float, float, float, float> calc_position_curvature_yaw(float s)

Calculates (x, y) position, curvature, and yaw angle at a given s.

Parameters:

s – The arc length parameter.

Returns:

Tuple of (x, y, curvature, yaw).

std::vector<float> get_s() const

Gets the computed arc lengths (s values) for the input points.

Returns:

Vector of arc lengths.

Public Members

std::vector<float> s

Length parameter.