This topic is now archived and is closed to further replies.



Recommended Posts

Direction? I'm not sure what exactly you mean by that, if you mean the x, y and z components of the vector then you do it like this. If you have a vector defined by two angles and a magnitude then:

x = v.cos(phi).sin(theta)
y = v.sin(phi)
z = v.cos(phi).cos(theta)

Where phi is the angle between the x/z plane and the vector, theta is the angle between the vector and the x-axis and v is the magnitude of the vector.

These calculations assume the +z-axis runs towards the center of the screen, the +y-axis runs up the screen and the +x-axis runs to the right of the screen.

If you mean how do you calculate the magnitude of the vector and the angles it's orientated at. If you have the vector defined as x,y,z. Then do this:

v = sqrt(x.x+y.y+z.z)
theta = tan-1(z/x)
phi = sin-1(y/v)

Using the same situation as above.

I think that's right. Hope it helps.

Edited by - Chris F on June 17, 2000 12:34:39 AM

Share this post

Link to post
Share on other sites