Beispiel #1
0
alpha = np.random.rand() * 360. * u.deg
delta = math.acos(np.random.random() * 2. - 1) * u.rad
delta = delta.to(u.deg) - 90. * u.deg
phi = 90. * u.deg

v = coo.spherical_to_cartesian(1., alpha, delta)
#Note that the input angles should be in latitude/longitude or
#elevation/azimuthal form.  I.e., the origin is along the equator
#rather than at the north pole.

lon = alpha
lat = delta
phi = phi

r = R.EulerAngleRotation(lon, lat, phi, 'zyz')
#Rotates one coordinate system into another (fixed) coordinate system.
#All coordinate systems are right-handed. The sign of the angles is
#determined by the right-hand rule.

############

v = [6, 5, 20.]
v = v / np.sqrt(np.dot(v, v))
d, lat, lon = coo.cartesian_to_spherical(v[0], v[1], v[2])
phi = 0. * u.rad
r = R.EulerAngleRotation(lon, lat, phi, 'zyz')
v_new = r.spherical2cartesian(lon, lat)

r = R.from_euler('zyz', [lon.value, lat, 0.], degrees=False)
r.apply(v)