Function lupnt::AngleBetweenVecs(const MatX&, const MatX&)

Function Documentation

VecX lupnt::AngleBetweenVecs(const MatX &x, const MatX &y)

Compute the angle between two vectors.

Row-wise angle between corresponding rows of x and y [rad].

Matrix overload of AngleBetweenVecs; computed via acos of the row-wise dot-product of normalized rows (clamped to [-1, 1]).

Parameters:
  • x – First vector

  • y – Second vector

  • x – Matrix whose rows are vectors to compare

  • y – Matrix whose rows are vectors to compare (same shape as x)

Returns:

Angle between the two vectors in radians

Returns:

Vector of per-row angles [rad], in [0, pi]