8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89701eb commit 6b15663Copy full SHA for 6b15663
lib/mpl_toolkits/mplot3d/axes3d.py
@@ -4053,6 +4053,6 @@ def as_cardan_angles(self):
4053
qw = self.scalar
4054
qx, qy, qz = self.vector[..., :]
4055
azim = np.arctan2(2*(-qw*qz+qx*qy), qw*qw+qx*qx-qy*qy-qz*qz)
4056
- elev = np.arcsin( 2*( qw*qy+qz*qx)/(qw*qw+qx*qx+qy*qy+qz*qz)) # noqa E201
4057
- roll = np.arctan2(2*( qw*qx-qy*qz), qw*qw-qx*qx-qy*qy+qz*qz) # noqa E201
+ elev = np.arcsin(np.clip(2*(qw*qy+qz*qx)/(qw*qw+qx*qx+qy*qy+qz*qz)), -1, 1)
+ roll = np.arctan2(2*(qw*qx-qy*qz), qw*qw-qx*qx-qy*qy+qz*qz)
4058
return elev, azim, roll
0 commit comments