Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multiplier to get more consistent behavior at singularities for zyx sequence #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rowan/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,11 +852,11 @@ def to_euler(q, convention="zyx", axis_type="intrinsic"): # noqa: C901
zero_terms = np.arctan2(multiplier * mats[..., 0, 2], mats[..., 2, 2])
elif convention == "zyx":
beta = np.arcsin(-mats[..., 2, 0])
multiplier = mats[..., 2, 0] if axis_type == "extrinsic" else 1
where_zero = np.isclose(np.cos(beta), 0, atol=atol)

gamma = np.where(where_zero, 0, np.arctan2(mats[..., 2, 1], mats[..., 2, 2]))
alpha = np.where(where_zero, 0, np.arctan2(mats[..., 1, 0], mats[..., 0, 0]))
zero_terms = np.arctan2(-mats[..., 0, 1], mats[..., 1, 1])
zero_terms = np.arctan2(multiplier *-mats[..., 0, 1], mats[..., 1, 1])
elif convention == "zxy":
beta = np.arcsin(mats[..., 2, 1])
multiplier = mats[..., 2, 1] if axis_type == "extrinsic" else 1
Expand Down