Function compute_distance_d

Function Documentation

inline float compute_distance_d(const float &x, const float &y, const float &x_r, const float &y_r, const float &heading_r)

Computes the normal distance from a point (x, y) to a reference point (x_r, y_r) along a reference angle psi_r.

This function calculates the perpendicular distance from a given point to a reference line defined by a reference point and an angle. The distance is computed using the following formula:

Parameters:
  • x – The x-coordinate of the point.

  • y – The y-coordinate of the point.

  • x_r – The x-coordinate of the reference point.

  • y_r – The y-coordinate of the reference point.

  • heading_r – The reference angle in radians.

Returns:

The normal distance from the point to the reference line.