-
Notifications
You must be signed in to change notification settings - Fork 715
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
Support multiple intrinsic orders in quat.fromEuler #407
Conversation
@stefnotch please review this change when you get a chance 😄 |
gkjohnson has left some pretty good comments, please do take a look at them. And, maybe the order should be |
@gkjohnson I addressed your review comments, let me know if this is more what you had in mind. |
@DCtheTall Great thanks! A few thoughts:
Of course @stefnotch will have the final opinion on this but those are my 2 cents. Thanks for the improvements! |
@gkjohnson thank you for putting so much thought into this. I am also open to adding a new argument to I'll defer to @stefnotch and see what his thoughts are. |
I suppose adding a new argument to 'fromEuler' would be reasonably clean. (Sort of related #369 (comment) ) |
Done. Also decided to support all intrinsic orders while I was at it. I borrowed pretty shamelessly from Three.js's implementation but with the proper variable names for this library. |
@gkjohnson friendly ping |
Thanks for the ping I didn't realize the ball was in my court. I just left a comment but after that's addressed I think the rest is up to the maintainers. Thanks! |
@DCtheTall Looks great, merged! Thank you and gkjohnson very much for all your work on this 🎉 |
order = 'zyx'; | ||
} | ||
|
||
switch (order.toLowerCase()) { |
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.
toLowerCase()
causes an unavoidable string allocation in what is (possibly) a hot path. :/
I don't know if this is part of the API now, but I would prefer if people had to put their order argument in lower-case.
break; | ||
|
||
case 'zyx': | ||
default: |
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.
Falling back to zyx
when specifying an order that isn't supported (e.g. xyx
) feels like an API footgun, I would rather throw an error here.
@magcius Those are some quite valid concerns. Luckily, this isn't a part of the official API yet, which means that a PR that changes this behaviour would be very welcome. |
I missed that these concerns were already addressed in 3a321ea, apologies. |
Fixes #403.