-
Notifications
You must be signed in to change notification settings - Fork 37
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
Do we really need normalized-flag in Quaternion
?
#60
Comments
I'm surprised that simply the presence of the I'd add to your concerns that there are several places in the code where type-stability is not guaranteed due to the use of The choice of Rotations.jl to represent unit quaternions as a subtype of What you seem to be proposing, dropping |
What operations are actually made faster by the
and could be even faster (and more accurate) if we used Meanwhile, the Many places fail to set the Meanwhile, unitness isn't something we actually work to preserve even when we do have it.
Chain enough operations and the Fixing this doesn't have to be breaking, I think. We can overload |
@mikmoore these arguments for dropping
In short, I agree we could add |
Good question. I'm no expert on this, but I did some rough calculations and estimated that So a freshly normalized quaternion should safely satisfy I don't really trust myself to have done the above analysis correctly, so I took a more empirical approach. A numerical evaluation over 100e6 randn normalized quaternions never saw So for freshly-normalized quaternions, So I would propose a tolerance in the range of That said, if we don't use Obviously, for |
The problems
The following are what I am concerned about.
Someone just needs quaternion operations, without the flag.
See comments in Makie.jl for example.
Performance disadvantage
The following
MyQuaternion
is a quaternion without the flag. The benchmark shows-5.49% => improvement (5.00% tolerance)
.The flag is not well-documented, and some operations don’t work properly with the flag.
See #36, #39, #51 and #59.
How to fix these problems
Rotations.QuatRotation
would be helpful.Rotations.jl
package have a dependency onQuaternions.jl
, and conversionQuaterion
<->QuatRotation
is supported.Rotations
package, adding a new typeQuaternions.UnitQuaternon
seems better, I guess.QuatRotaions
is a rotation parametrization withQuaternion
, but it is regarded asAbstractMatrix
. i.e. the antipodal quaternions are equal. (Treating antipodal quaternions as equal breaks some operations Rotations.jl#171)The text was updated successfully, but these errors were encountered: