Skip to content

Commit

Permalink
Array API version of norm_angle
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderFabisch committed Aug 23, 2023
1 parent dd8b85c commit aa862c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pytransform3d/rotations/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ def norm_angle(a):
a_norm : float or array-like, shape (n,)
Normalized angle(s) in radians
"""
a = np.asarray(a, dtype=np.float64)
return (a - (np.ceil((a + np.pi) / two_pi) - 1.0) * two_pi)
xp = array_namespace(a)
a = xp.asarray(a, dtype=xp.float64)
return a - (xp.ceil((a + xp.pi) / two_pi) - 1.0) * two_pi


def norm_axis_angle(a):
Expand Down

0 comments on commit aa862c9

Please sign in to comment.