Rotation matrix for azimuth and zenith angles

lightningbolt
Messages
2
Reaction score
0
I have a shape with spherical coordinate (r, theta, phi) which I can convert to Cartesian. I want to apply rotation to the shape by incrementing theta & phi.
I figured out the matrix for rotating azimuth angle is
{
{cos(theta), -sin(theta), 0}
{sin(theta), cos(theta), 0}
{ 0, 0, 1}
}
How to find the rotation matrix for Zenith angle?.
Thanks.
 
Physics news on Phys.org
Why don't you increment θ and φ as you wish then convert to Cartesian?
 
@SonyAD,
If you change θ and φ in spherical coordinates and convert to Cartesian, it won't result in the change you expect. It gives garbage values.
i.e I can't just add 5 degree to θ or φ, if i want to rotate the shape 5 degree.
Thanks.
 
I don't think I understand what you're after.

If it is rotation equations inside a Cartesian system you're after:

v1 = calf*xi+salf*zi;
v2 = calf*zi-salf*xi;
v3 = cbet*yi+sbet*v2;

zr = cbet*v2-sbet*yi;
xr = cgam*v1+sgam*v3;
yr = cgam*v3-sgam*v1;

salf = \sin(\alpha);
calf = \cos(\alpha);
etc.

In case you're making a mistake converting to Cartesian, I've worked out how to do it and http://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates":

x = radius · sin(θ) · cos(φ)
y = radius · sin(θ) · sin(φ)
z = radius · cos(θ)

In case the spherical coordinate system isn't doing what you expect it to, when you increment θ and φ this is what actually happens:

You rotate the initial point around the absolute Y axis.
You rotate the transformed point around the absolute Z axis.

Are you trying to interpret mouse input?
 
Last edited by a moderator:

Similar threads

Replies
7
Views
3K
Replies
2
Views
2K
Replies
31
Views
2K
Replies
7
Views
3K
Back
Top