-
Notifications
You must be signed in to change notification settings - Fork 216
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
t_quat::set: return a zero rotation instead of a zero quaternion #987
Conversation
It could be argued that the default constructor for quaternion should return a zero rotation i.e. {0, 0, 0, 1}, but I decided not to go there.
Is this solving a particular problem? What happens with the unmodified code? The default vsg::quat should probably match what glm does but just had a look at glm and left wondering WTF. So many headers for such basic functionality, not at all clear what is going on from a quick glance. Ahhh one of the main reasons I opted to implement maths classes part of the VSG, code base has got to be readable to be maintainable. |
I been thinking about it, I'm leaning toward making zero rotation the default rather than 0,0,0,0 "invalid" rotation that we have right now. Still a bit torn though... |
Do not be torn. Please initialize it as zero-rotation. I would have felt
surprised it were not a unit-quaternion.
[0, 0, 0, 1] - 0 rotation valid quaternion.
[0, 0, 0, 0] - NOT a quaternion
[nan, nan, nan, nan] - Could be a quaternion, but atleast things break
immediately.
…On Wed, Oct 4, 2023 at 1:23 PM Robert Osfield ***@***.***> wrote:
I been thinking about it, I'm leaning toward making zero rotation the
default rather than 0,0,0,0 "invalid" rotation that we have right now.
Still a bit torn though...
—
Reply to this email directly, view it on GitHub
<#987 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHWFHIO47DRM7VQ7GUYHNVDX5WLRJAVCNFSM6AAAAAA5SZOFDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGMZTKNBRHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
S <https://www.nodein.com/>uresh K. Kannan, Ph.D.,
Chief Scientist, Nodein
https://www.nodein.com
|
It's fixing the case of quat(0.0f, vec3(0.0f , 0.0f, 0.0f)) to return a 0 rotation. While this could be sensibly specified as undefined, Open Scene Graph set it to a zero rotation. Actually, Quat() in OSG results in (0, 0, 0, 1), so maybe that's the answer here too.
I don't care about glm 😄 , but OSG compatibility might be worth considering. |
I don't agree that [0,0,0,0] is not a valid quaternion. It's certainly not a rotation, but it can meaningfully be used in quaternion multiplication. There's a performance cost in having these primitive math types have non-trivial default constructors, but I suppose that we are over that. |
Agreed that the zero element is a valid quaternion. As long as it is clear
that when a Quat is constructed it does not necessarily have magnitude one
and hence not a quaternion that represents a rotation.
…On Wed, Oct 4, 2023 at 7:20 PM Tim Moore ***@***.***> wrote:
Do not be torn. Please initialize it as zero-rotation. I would have felt
surprised it were not a unit-quaternion. [0, 0, 0, 1] - 0 rotation valid
quaternion. [0, 0, 0, 0] - NOT a quaternion [nan, nan, nan, nan] - Could be
a quaternion, but atleast things break immediately.
… <#m_34790264754041740_>
On Wed, Oct 4, 2023 at 1:23 PM Robert Osfield *@*.*> wrote: I been
thinking about it, I'm leaning toward making zero rotation the default
rather than 0,0,0,0 "invalid" rotation that we have right now. Still a bit
torn though... — Reply to this email directly, view it on GitHub <#987
(comment)
<#987 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AHWFHIO47DRM7VQ7GUYHNVDX5WLRJAVCNFSM6AAAAAA5SZOFDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGMZTKNBRHA
<https://github.com/notifications/unsubscribe-auth/AHWFHIO47DRM7VQ7GUYHNVDX5WLRJAVCNFSM6AAAAAA5SZOFDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGMZTKNBRHA>
. You are receiving this because you are subscribed to this thread.Message
ID: @.*>
-- S https://www.nodein.com/uresh K. Kannan, Ph.D., Chief Scientist,
Nodein https://www.nodein.com
I don't agree that [0,0,0,0] is not a valid quaternion. It's certainly not
a rotation, but it can meaningfully be used in quaternion multiplication.
There's a performance cost in having these primitive math types have
non-trivial default constructors, but I suppose that we are over that.
—
Reply to this email directly, view it on GitHub
<#987 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHWFHIIUHPQPFW7SATOINXLX5XVMZAVCNFSM6AAAAAA5SZOFDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXG43TQMJWGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
It could be argued that the default constructor for quaternion should return a zero rotation i.e. {0, 0, 0, 1}, but I decided not to go there.