-
Notifications
You must be signed in to change notification settings - Fork 44
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
Define exp(UnitQuaternion{T}(0, 0, 0, 0)) = one(UnitQuaternion{T}) #126
Comments
I'm mostly just a bystander at this point, but
is not really true, since an all-zeros |
I agree that it's weird that "logs of unit quaternions" are expressed using the same data type as the unit quaternions themselves, but AFAICS, that is how the code is currently written. The zero I was referring to is an element of the Lie algebra (not the Lie group). Exp of it gives you a quaternion but it's not one -- and this is true not just of the zero Lie algebra element but also of all other logs-of-quaternions. Concretely, the line Rotations.jl/src/unitquaternion.jl Line 246 in 2b7404c
computes an expression containing sin(θ) / θ , which is NaN, but that is a removable point discontinuity, and AFAICS there is one clear choice for its value. I.m.o., the more complex version is the one that doesn't do the mathematically natural thing (so it all boils down to what the mathematically natural thing is 🙂).
This showed up when I was doing SLERP interpolation, with Good point on performance loss -- would that be due to a run-time check whether the input equals zero? |
The code change I'm proposing is something like #127. |
Ah, I did not realize that. |
Ah, I was somehow thinking of |
We now have julia> exp(RotationVecGenerator(0.,0.,0.)) == one(QuatRotation)
true This issue seems resolved. |
As currently written,
exp(UnitQuaternion{Float64}(0, 0, 0, 0))
evaluates toUnitQuaternion(NaN, NaN, NaN, NaN)
. Upon initial thought, I think it's mathematically "correct" to special-case this behavior (i.e. when the argument is exactly zero) and define the result to be the identity quaternion. We're applying the exponential map to zero, viewed as an element of the Lie algebra of unit quaternions, and the result should be the identity element of the Lie group. WDYT?The text was updated successfully, but these errors were encountered: