Polar to Cartesian Conversion

2 replies [Last post]
Lavender81
Offline
Joined: 2006-02-17

The Coordinate system I have on paper looks like :

+Z
mu ( a vector)
* +
| +
| +
|~+
|+
*----* +Y
/~.
/ .
/ .
+X * . (projection of mu)

The angle between mu and the z-axis is *theta* and the angle between the projection of mu and the x-axis is *Phi*. Theta and phi are equivalent to the following components :

X = mu.sin(theta).cos(phi)
Y = mu.sin(theta).sin(phi)
Z = mu.cos(theta)

Whereas j3d coordinate system looks like :

+Y

*
|
|
|
|
*----* +X
/
/
/
+Z *

How can I convert theta and phi in my system, to x,y and z in j3d's ?
Does it make sense to just map the axii in this way ?
X_java = Y = mu.sin(theta).sin(phi)
Y_java = Z = mu.cos(theta)
Z_java = X = mu.sin(theta).cos(phi)

Lavender81
Offline
Joined: 2006-02-17

Thank you.
Another follow up question : Should the angles be expressed in degrees or rads ?

nvaidya
Offline
Joined: 2004-08-03

If you haven't changed the definitions of theta and phi, then the same expressions will be applicable for both systems - actually, from what I see, the 2 systems are one and the same if you align them.

If, however, you have changed the definitions of the angles so that theta is now measured from Y_java and phi from Z_java, then your second set of expressions look correct.