-
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
slerp
breaks flag for quaternion normalization
#51
Comments
I agree, this would be sensible. The only thing to check is if after repeated application of |
Thanks for the comment! I will make a PR to resolve this issue after #60 is discussed. |
Since #60 proposes a breaking change and this issue doesn't, proceeding with a PR anyways would be useful. |
slerp
breaks flag for quaternion normaliationslerp
breaks flag for quaternion normalization
Oh, I just noticed we also have julia> q1 = Quaternion(1.,0.,0.,0.,true)
QuaternionF64(1.0, 0.0, 0.0, 0.0, true)
julia> q2 = Quaternion(0.,1.,0.,0.,true)
QuaternionF64(0.0, 1.0, 0.0, 0.0, true)
julia> linpol(q1, q2, 0.2)
QuaternionF64(0.9510565162951535, 0.3090169943749474, 0.0, 0.0, true)
julia> slerp(q1, q2, 0.2)
QuaternionF64(0.9510565162951535, 0.3090169943749474, 0.0, 0.0, false) I think |
Are they entirely equivalent, or is there some combination of inputs for which they will produce different results? |
Note that these functions return different values for non-unit quaternion. julia> q3 = Quaternion(2.,1.,0.,0.,true)
QuaternionF64(2.0, 1.0, 0.0, 0.0, true)
julia> q4 = Quaternion(3.,0.,0.,0.,true)
QuaternionF64(3.0, 0.0, 0.0, 0.0, true)
julia> slerp(q3, q4, 0.2)
QuaternionF64(2.0, 1.0, 0.0, 0.0, true)
julia> linpol(q3, q4, 0.2)
QuaternionF64(2.2, 0.8, 0.0, 0.0, true)
My question is, what's the expected behavior of
|
The following are references on slerp, all of which deal with unit quaternions.
https://en.wikipedia.org/wiki/Slerp
http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
https://docs.unity3d.com/ScriptReference/Quaternion.Slerp.html |
@keesvp @SimonDanisch |
I tried searching for |
On the current master branch, julia> q1 = Quaternion(1.,0,0,0,true)
QuaternionF64(1.0, 0.0, 0.0, 0.0, true)
julia> q2 = Quaternion(0,1.,0,0,true)
QuaternionF64(0.0, 1.0, 0.0, 0.0, true)
julia> slerp(q1,q2,0.2)
QuaternionF64(0.9510565162951535, 0.3090169943749474, 0.0, 0.0, false)
julia> linpol(q1,q2,0.2)
QuaternionF64(0.9510565162951535, 0.3090169943749474, 0.0, 0.0, true)
julia> @benchmark slerp($q1,$q2,0.2)
BenchmarkTools.Trial: 10000 samples with 994 evaluations.
Range (min … max): 30.258 ns … 47.363 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 30.450 ns ┊ GC (median): 0.00%
Time (mean ± σ): 30.738 ns ± 1.569 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
█
▇█▄▂▂▂▁▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▁▂▂▂▂▂▂▂ ▂
30.3 ns Histogram: frequency by time 37.4 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
julia> @benchmark linpol($q1,$q2,0.2)
BenchmarkTools.Trial: 10000 samples with 991 evaluations.
Range (min … max): 40.956 ns … 120.753 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 41.835 ns ┊ GC (median): 0.00%
Time (mean ± σ): 42.864 ns ± 5.312 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▄█▇▂ ▁▂ ▁
████▆▆▇██▇▅▇▆▅▁▃▄▅▁▃▃▄▃▁▁▅▄▄▅▃▁▄▄▃▄▃▄▄▃▃▄▁▁▁▃▄▁▁▁▁▁▁▃▁▁▃▁███ █
41 ns Histogram: log(frequency) by time 67.6 ns <
Memory estimate: 0 bytes, allocs estimate: 0. |
The flag
false
should betrue
here becauseslerp
keeps norm of quaternion if the input quaternions are unit quaternions.The text was updated successfully, but these errors were encountered: