Quaternion conjugate?/inverse?
closed
Nexii Malthus
my quats maths is uh weak so feel free to correct me, but to do a inverse of a quaternion I would have expected the unmary operator to do that, however it negates all parts, instead of only negating the vector parts (x, y, z)
Could this be changed to be a conjugation operator instead perhaps?
Log In
H
Harold Linden
marked this post as
closed
I can't see any other implementations of quaternions that overload
-
in this way.IMO there's a case for providing conjugation, but being explicit makes the most sense, and we should have a function for it!
Nexii Malthus
Harold Linden yeah my feedback was more from zero context based on what operators make most sense to apply for quaternions. Negating quaternions make no sense unless you are doing conjugation for me.
Frio Belmonte
Negation is valid, even if rarely used for quaternions so overloading unary minus would feel off.
In SL ZERO_ROTATION/q actually produces the conjugate, but only because the rotation division operator assumes normalized quats (actual quat division q/p = q*conj(p)/|p| but SL skips the /|p| part, so 1/q = conj(q))... rather hacky, access to a proper conjugation method might have uses.
Nexii Malthus
Ah, it does the same in LSL legacy right now but food for thought