|
-
May 19th, 2001, 09:26 AM
#1
Thread Starter
Addicted Member
3D rotation
How do I rotate a vector by a quaternion?
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
-
May 19th, 2001, 02:17 PM
#2
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
May 28th, 2001, 12:37 PM
#3
Lively Member
So what's 'quaternion', I haven't found it in my dictionary.
Perhaps I can help you.
-
May 28th, 2001, 02:19 PM
#4
Monday Morning Lunatic
It seems to be an axis in the first 3 elements, and the last is an angle to rotate around that axis (clockwise? anticlockwise? anyone know?)
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
May 28th, 2001, 06:12 PM
#5
Lively Member
A quaternion is a vector rotation angle.
The vector part is the axis about which the vertices are rotated.
The angle uses the right hand rule for rotation. You point your right hand thumb in the direction of the vector and your fingers curl in the positive angle direction
Common Quaternions
x axis D3DXQUATERNION ( 1, 0, 0, ANGLE)
y axis D3DXQUATERNION ( 0, 1, 0, ANGLE)
z axis D3DXQUATERNION ( 0, 0, 1, ANGLE)
They are very usfeul for smooth movement of objects. Using a linear intepolation function you can move smoothy from one angle and rotation to another.
-
May 28th, 2001, 06:23 PM
#6
Monday Morning Lunatic
I'll ask my question now as well 
How do you concatenate two quaternions? (as in, you have two rotations and you want a single rotation to express that) Or isn't it possible?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
May 29th, 2001, 08:37 AM
#7
Lively Member
I think to concatenate 2 quaternions, you will just have to handle with the angles as if they are vectors, and then you add one to the other.
-
May 30th, 2001, 01:32 AM
#8
transcendental analytic
hi everyone!
nah, you don't treat quaternions as vectors, to combine rotations you do quaternion multiplication
Q1 X Q2 = ( w1·w2 - v1·v2, w1·v2 + w2·v1 + v1xv2 )
· is dot product and x is crossproduct
the components w,x,y and z where:
Q1 = w1 + x1*i + y1*j + z1*k
Q2 = w2 + x2*i + y2*j + z2*k
i,j and k are the unit quaternions
and the vectors v1 and v2 are:
v1 = (x1, y1, z1)
v2 = (x2, y2, z2)
simplified:
Q1 X Q2 = (w1*w2 - x1*x2 - y1*y2 - z1*z2) + (w1*x2 + x1*w2 + y1*z2 - z1*y2)*i + (w1*y2 + y1*w2 + z1*x2 - x1*z2)*j + (w1*z2 + z1*w2 + x1*y2 - y1*x2)*k
quaternion multiplication is not commutative
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 30th, 2001, 07:05 AM
#9
Monday Morning Lunatic
Is it associative?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
May 31st, 2001, 03:04 AM
#10
transcendental analytic
i guess it is (i'm not sure, never tested) as long as they are in the correct order.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|