Class AngleOp

Class Documentation

class AngleOp

Class to perform operations with angles. The angles are in radians and in the range [-pi, pi).

Public Functions

AngleOp() = delete
AngleOp(const AngleOp&) = delete
AngleOp(AngleOp&&) = delete

Public Static Functions

static inline float normalize_angle(float angle)

Normalize an angle to the range [-pi, pi).

static inline float angle_diff(float a, float b)

Computes b - a in the range [-pi, pi).

static inline float bisect_angle(float a, float b)

Finds the angle bisector between two angles. The inputs can be given in any order and they don’t need to be normalized. The output is normalized.

static inline float weighted_circular_mean(const std::vector<float> &angles, const std::vector<float> &weights)

Computes the weighted circular mean of a set of angles, given their respective weights. The inputs don’t need to be normalized. The output is in the range [-pi, pi).

static inline float cos_angle_diff(float a, float b)

Computes the cosine of the angle difference between two angles. The inputs don’t need to be normalized. The order of the angles doesn’t matter, since cos(a - b) = cos(b - a).