diff --git a/utils/converter.py b/utils/converter.py index 33bc2e1ee14edc8015c8305e81e00906209ba8d7..f19d01f03c01305bb715c313970bedc16027c896 100644 --- a/utils/converter.py +++ b/utils/converter.py @@ -1,5 +1,6 @@ from math import cos, acos, pi from numpy import arange +from cmath import exp, phase def deg_to_u(degrees): return [cos(x * pi / 180) for x in degrees] @@ -9,3 +10,11 @@ def range_in_deg(res): def u_to_deg(u): return [acos(x) * 180 / pi for x in u] + +def vectorWrapToPi(vector): + """Wraps a list of angles in the [-π, π] range.""" + return [wrapToPi(x) for x in vector] + +def wrapToPi(theta): + """Wraps an angle in the [-π, π] range.""" + return phase(exp(1j * theta)) \ No newline at end of file