Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite497c77

Browse files
Fix arcsin domain error
1 parent343b3dc commite497c77

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,9 +4023,10 @@ def as_cardan_angles(self):
40234023
The inverse of `from_cardan_angles()`.
40244024
Note that the angles returned are in radians, not degrees.
40254025
"""
4026-
qw=self.scalar
4027-
qx,qy,qz=self.vector[..., :]
4026+
n=np.sqrt(self.norm)
4027+
qw=self.scalar/n
4028+
qx,qy,qz=self.vector[..., :]/n
40284029
azim=np.arctan2(2*(-qw*qz+qx*qy),qw*qw+qx*qx-qy*qy-qz*qz)
4029-
elev=np.arcsin(2*(qw*qy+qz*qx)/(qw*qw+qx*qx+qy*qy+qz*qz))# noqa E201
4030+
elev=np.arcsin(np.clip(2*(qx*qz+qw*qy),-1,1))
40304031
roll=np.arctan2(2*(qw*qx-qy*qz),qw*qw-qx*qx-qy*qy+qz*qz)# noqa E201
40314032
returnelev,azim,roll

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp