-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Correct roll angle units, issue #28256 #28261
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
Conversation
Pass roll angle to view_init() in degrees (not radians)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Thanks for catching this! Is there a way that you can modify the existing mouse drag tests or add a new one to check for this? Those tests are a bit tricky to write / understand since they spoof mouse movements, so if there isn't an easy way to do that I think I would be fine with skipping it. |
I suppose I could try - but which existing tests did you have in mind? It seems most tests are for |
I was thinking about |
I'll give it a try and let you know, it might take me a day or two |
Add tests for rotation using the mouse (test_rotate), with and without roll. The test with nonzero roll fails if the roll angle is passed with wrong units (issue matplotlib#28256).
2c532c9
to
acd21eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, approved and once another maintainer adds their approval as well it will be merged in. The "codecov/project/tests" CI failure is more informational and not a blocker.
Thank you and congratulations on your first contribution to matplotlib! We hope to see more of you, and contributions are always welcome!
Well, now that we're at it...
And similarly:
That is to say, the ordering you chose is not the common one. And if you consider that searching for both yields
(some links are non-committal), then it becomes clear that the Should we raise an issue to change it? |
I had a comment and it was mostly wrong when I actually went back to look, so ignore that email. I forget the reasoning behind changing the argument order, but I believe it’s to match the order in which the rotations are applied. I’d be hesitant to change it again. Matching Matlab convention is nice, but not an actual goal of the matplotlib library. The kwargs are clear and unambiguous as-is, and we try to minimize API changes per this policy: https://matplotlib.org/devdocs/devel/api_changes.html |
I understand the hesitation, and I don't particularly care about what Matlab's convention is either. But I do care that all the rest of the world appears to do something else than what matplotlib does at the moment. And the matplotlib order emphatically does not match the order in which the rotations are applied: that is azim, elev, roll. |
Elevation and azimuth are applied at the same time, in effect neither comes before the other. https://github.com/matplotlib/matplotlib/blob/main/lib/mpl_toolkits/mplot3d/axes3d.py#L1220-L1222 |
Thinking about it more, I think you’re more right about the rotation order if this is conceptualized as Euler angles. If thinking about extrinsic rotations, then the rotation order is roll, elev, then azim. If thinking about intrinsic rotations then the rotation order is azim, elev, then roll. The definitions in the docs are still unambiguous so I still think this is fairly marginal to make a change of API, but maybe @oscargus can weigh in. |
Well actually, to be precise, mplot3d's
Ah, yes, now we're talking!
Ah yes. So perhaps it is time to open a separate Issue and close this PR ;) |
In mplot3d.Axes3D._on_move(), pass roll angle to view_init() in degrees (as it expects; not converted to radians, mistakenly).
Resolves #28256.