Function angle_difference

Function Documentation

arma::fvec angle_difference(const arma::fvec &a, const arma::fvec &b)

Computes the minimal signed angular difference between two angles.

This function calculates the element-wise difference between two vectors of angles a and b, normalizing the result into the range (-π, π]. This is useful for comparing orientations while properly handling angular wrap-around.

Parameters:
  • a – A vector of angles in radians (start angles).

  • b – A vector of angles in radians (end angles).

Returns:

arma::fvec Vector of signed angular differences (b - a), each in the range (-π, π].