wraps
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import numpy as np
|
||||
import winkelumrechnungen as wu
|
||||
|
||||
|
||||
def arccot(x):
|
||||
@@ -9,5 +10,19 @@ def cot(a):
|
||||
return np.cos(a) / np.sin(a)
|
||||
|
||||
|
||||
def wrap_to_pi(x):
|
||||
def wrap_mpi_pi(x):
|
||||
return (x + np.pi) % (2 * np.pi) - np.pi
|
||||
|
||||
|
||||
def wrap_mhalfpi_halfpi(x):
|
||||
return (x + np.pi / 2) % np.pi - np.pi / 2
|
||||
|
||||
|
||||
def wrap_0_2pi(x):
|
||||
return x % (2 * np.pi)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(wu.rad2deg(wrap_mhalfpi_halfpi(wu.deg2rad(181))))
|
||||
print(wu.rad2deg(wrap_0_2pi(wu.deg2rad(181))))
|
||||
print(wu.rad2deg(wrap_mpi_pi(wu.deg2rad(181))))
|
||||
|
||||
Reference in New Issue
Block a user