View previous topic :: View next topic |
Author |
Message |
Carlos
Joined: 19 Mar 2004 Posts: 396 Location: Canyon, TX
|
Posted: Thu Jul 08, 2004 1:28 pm Post subject: [OT] coordinates rotation |
|
|
I know some of you have done (or do) 3D programming, so I'd like to know how to perform a rotation but using a different axis than X, Y or Z. (I really don't know how to phrase it).
In other words: to do a Z-rotation, this matrix is used: [ [ cos, sin, 0 ] [ -sin, cos, 0 ] [ 0, 0, 1 ] ]. The way I see it, it uses vector (0,0,1) as rotation axis, right? Is that how it's said? Anyway, what I want is to be able to caculate the matrix to do a rotation using any given vector (x,y,z).
Thanks a lot! |
|
Back to top |
|
|
nail
Joined: 30 Jun 2004 Posts: 18 Location: Krasnoznamensk, Moscow region, Russia
|
Posted: Fri Jul 09, 2004 4:53 am Post subject: |
|
|
Hm... I think you choosed wrong place for this question. I'll try to introduce you in this topic. There are several ways to rotete your object.
First - Euler angles. When you have sequense of rotation around X then Y then Z. Or around Z then around Y, then X. Or any another sequence. In this case you should create X-rotation matrix, Y-rotation matrix, Z-rotation matrix and then multiply them in chosen order. You'll get final matrix for your rotation. Euler angles sometimes called yaw-pitch-roll - they are airplane therms.
Second - Axis / angle. When you set axis as vector and angle of rotation around it. Check out http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/ page
Third - most powerful method (and so most complicated for novice) is quaternions. Quaternion is 4D mathematical object that human can't imagine. Learn more about quaternions on http://www.gamedev.net/reference/articles/article1095.asp |
|
Back to top |
|
|
Carlos
Joined: 19 Mar 2004 Posts: 396 Location: Canyon, TX
|
Posted: Fri Jul 09, 2004 11:27 am Post subject: |
|
|
nail wrote: | Hm... I think you choosed wrong place for this question. I'll try to introduce you in this topic. There are several ways to rotete your object.
First - Euler angles. When you have sequense of rotation around X then Y then Z. Or around Z then around Y, then X. Or any another sequence. In this case you should create X-rotation matrix, Y-rotation matrix, Z-rotation matrix and then multiply them in chosen order. You'll get final matrix for your rotation. Euler angles sometimes called yaw-pitch-roll - they are airplane therms.
|
That's what I had. I needed a more general solution.
Thanks!!!! That's exactly what I was looking for!
I can pass on that for now. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|