Skip to content
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

UnitQuaternion quaternion number equality conflicts with rotation matrix equality #189

Closed
jenkspt opened this issue Nov 5, 2021 · 2 comments
Labels

Comments

@jenkspt
Copy link

jenkspt commented Nov 5, 2021

julia> q = UnitQuaternion(1., 0., 0., 1.)
3×3 UnitQuaternion{Float64} with indices SOneTo(3)×SOneTo(3)(0.707107, 0.0, 0.0, 0.707107):
 0.0  -1.0  0.0
 1.0   0.0  0.0
 0.0   0.0  1.0

julia> -q
3×3 UnitQuaternion{Float64} with indices SOneTo(3)×SOneTo(3)(-0.707107, -0.0, -0.0, -0.707107):
 0.0  -1.0  0.0
 1.0   0.0  0.0
 0.0   0.0  1.0

julia> q  -q
true

The problem here is that q and -q are represented by the same 3x3 rotation matrix, but in terms of quaternion math ops, q should not equal q.

I'm thinking that the quaternion math should take precedent here, and thus q should not equal -q

@hyrodium
Copy link
Collaborator

hyrodium commented Nov 6, 2021

This will be fixed in #175.

julia> q = UnitQuaternion(1., 0., 0., 1.)  # with PR#175
3×3 UnitQuaternion{Float64} with indices SOneTo(3)×SOneTo(3)(0.707107, 0.0, 0.0, 0.707107):
 0.0  -1.0  0.0
 1.0   0.0  0.0
 0.0   0.0  1.0

julia> -q
3×3 StaticArrays.SMatrix{3, 3, Float64, 9} with indices SOneTo(3)×SOneTo(3):
 -0.0   1.0  -0.0
 -1.0  -0.0  -0.0
 -0.0  -0.0  -1.0

UnitQuaternion is a matrix rather than quaternion, so -q should be SMatrix.
This naming is confusing, so UnitQuaternion will be renamed QuatRotation. (#171 (comment))

@hyrodium hyrodium added the bug label Nov 6, 2021
@hyrodium
Copy link
Collaborator

This issue has been solved by #175.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants