### Thread: Converting onto XYZ from vector, need help.

1. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Nov 2005
Posts
134
Rep Power
0

#### Converting onto XYZ from vector, need help.

Hello people.

I have a vector that defines a rotation in degrees.
I must transform this onto XYZ (supposedly: world) so I can properly apply an impulse using a physics engine.

How can I do this?.
I'm stuck!.

Shorter question: How can I transform a vector onto XYZ components, if the vector defines a rotation angle in degrees.

My vector magnitude is used as a "power" multiplier for the final impulse, I think this can be left alone on the actual computation of the XYZ components.

2. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Nov 2005
Posts
134
Rep Power
0
I forgot to add: I'm using SIN and COS right now, however I was seeking for a more optimized solution. Sorry for not adding this on the original post.

I hope I'm making some sense here.
3. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Apr 2003
Posts
81
Rep Power
15
if you are using cyclidrical coordinates, R = length and W (theta) = angle
then X (or adjacent angle) = R Cos W
and Y (or opposite angle) = R Sin W
If you are using spherical coordinates it is different
4. Take a look at this link.
http://mathworld.wolfram.com/EulerAngles.html
You should have learned this stuff in school though.
5. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Nov 2005
Posts
8
Rep Power
0
Originally Posted by BioSlayer
Take a look at this link.
http://mathworld.wolfram.com/EulerAngles.html
You should have learned this stuff in school though.
If you plan on using a matrix to transform the vector using trigonomic operations, its HIGHLY recommended that you create something known as a Trigonomic Lookup Table, which contains basically an array of floating point numbers containing the results of a sin or cosine operation. Then the only magic is figuring out how the shift the array access index by 1/4 that of a full circle.

This is important to bear in mind that trigonomic operations basically kill the CPU, looking up a predefined trigonomic value is much more efficient.
6. No Profile Picture
Contributing User
Devshed Loyal (3000 - 3499 posts)

Join Date
May 2004
Posts
3,417
Rep Power
890
I think you might want to investigate quaternions
7. Originally Posted by MassKiller
This is important to bear in mind that trigonomic operations basically kill the CPU, looking up a predefined trigonomic value is much more efficient.
I looked around and I couldn't find much on this subject. Would you be willing to post a link or 2 about this?