Quaternions and Some Questions

Blitz3D Forums/Blitz3D Programming/Quaternions and Some Questions

KuRiX(Posted 2006) [#1]
Hi again friends. I need your math help again. Now it is about quaternions.

First, i don't understand quaternions well. I know they have 4 parameters: a vector and a scalar indicating the rotation in 3d space.

I don't need to understand them perfectly, but i need to know how to do some operations with them:

I want to compare 2 quaternions, to know how much different they are.

For example, if i had euler rotations, i could compare every angle (pitch,yaw,roll) just with abs(r1#-r2#) so i know the difference in every angle.

But what about quaternions?.

What i need is to compare two rotations in quaternions and update the second if they are different enough...


Damien Sturdy(Posted 2006) [#2]
hehe, I need to upgrade my knowledge a bit too, I've never worked with quartonians ...errr.. Quaternions! :)


VIP3R(Posted 2006) [#3]
Have you seen the Quaternion tutorial and code from Chris C?...

http://www.blitzmax.com/Community/posts.php?topic=55697

I'm not sure if it will help, but it should explain the basics etc.


Tom(Posted 2006) [#4]
Try this

QuatAngleDifference# = acos(q1\x*q2\x + q1\y*q2\y + q1\z*q2\z + q1\w*q2\w)

b.t.w, I don't think quaternions contain a regular vector, else why would quat.w have any bearing on the vector as it does in the above dotproduct code?


Sir Gak(Posted 2006) [#5]
Cygnus:
hehe, I need to upgrade my knowledge a bit too, I've never worked with quartonians ...errr.. Quaternions! :)

Glad you corrected yourself. As no doubt everyone knows, quartonians are people who believe in using American quarts, not metric liters, whereas Quaternions are those math thingees ;0