View Full Version : 3 angles to 1 vector....

haust

08-16-2000, 05:49 AM

Well, well, well, hi everybody !!

Given 3 angles (ax, ay, az) how can i get the vector representing the direction....

Without matrices and quaternions !!

I have the feeling that sin and cos are involved but i don't know how :(

thanks for the help....

ngill

08-16-2000, 06:07 AM

um... not 1 vector but two! http://www.opengl.org/discussion_boards/ubb/smile.gif

yes, sin and cos are involved... remember parametric equations back in trig/calc class?

given 2 angles you can have a vector from the origin to a point on the unit sphere! Just like if given 1 angle you can have a point on the unit circle (x=cos xa, y=sin ya) from 0-2pi, you could switch the sin and cos around, it'll still be a circle... just have different parts drawn first... hopefully I've sparked enough so you can figure out the rest...

Cheers

Navreet

ribblem

08-16-2000, 06:56 AM

The fastest way to do this is with matrixs but if you're not comfortable with them here is the next best way. (at least in my opinion)

Just draw a triangle for each of these angles you have on a piece of paper. Then it will be easy to see the trig needed to get each hypotonus. Each one these hypotonuses is the vector associated with a single angle. Then you'll want to normalize this vector. Do this for all 3 angles. Add these 3 vectors. Then normalize again.

haust

08-16-2000, 10:28 AM

Sorry to insist but,

a camera can have ONE direction/orientation vector so i maintain that it is possible to pack 3 angles into ONE normalized vector....

(You know like in quake 3 source)

still without matrices/quaternions

thanks.

Relic

08-16-2000, 10:53 PM

Actually the solution you are looking for is the final result of a multiplication of three 3x3 rotation matrices applied to a (x,y,z) vector.

For the correct answer you have to specify in which order you want to apply the rotation.

In the Redbook V1.1 Appendix F you find the matrices for the standard axis rotations.

Take the upper 3x3 and calculate

v' = Rz * Ry * Rx * v

(if that is your desired order!) giving three formulae with lots of sin and cos.

Depending on which vector you want to rotate (unit vector in z is a common case), you won't have to calculate the whole matrix, but just the third column.

Sorry, that's the way to do it. It's simple, but tedious.

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.