MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / from_cardan_angles

Method from_cardan_angles

lib/mpl_toolkits/mplot3d/axes3d.py:4407–4422  ·  view source on GitHub ↗

Converts the angles to a quaternion q = exp((roll/2)*e_x)*exp((elev/2)*e_y)*exp((-azim/2)*e_z) i.e., the angles are a kind of Tait-Bryan angles, -z,y',x". The angles should be given in radians, not degrees.

(cls, elev, azim, roll)

Source from the content-addressed store, hash-verified

4405
4406 @classmethod
4407 def from_cardan_angles(cls, elev, azim, roll):
4408 """
4409 Converts the angles to a quaternion
4410 q = exp((roll/2)*e_x)*exp((elev/2)*e_y)*exp((-azim/2)*e_z)
4411 i.e., the angles are a kind of Tait-Bryan angles, -z,y',x".
4412 The angles should be given in radians, not degrees.
4413 """
4414 ca, sa = np.cos(azim/2), np.sin(azim/2)
4415 ce, se = np.cos(elev/2), np.sin(elev/2)
4416 cr, sr = np.cos(roll/2), np.sin(roll/2)
4417
4418 qw = ca*ce*cr + sa*se*sr
4419 qx = ca*ce*sr - sa*se*cr
4420 qy = ca*se*cr + sa*ce*sr
4421 qz = ca*se*sr - sa*ce*cr
4422 return cls(qw, [qx, qy, qz])
4423
4424 def as_cardan_angles(self):
4425 """

Callers 2

_on_moveMethod · 0.80
test_quaternionFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_quaternionFunction · 0.64