Rotation matrix for azimuth and zenith angles

Click For Summary
The discussion focuses on finding the rotation matrix for zenith angles in spherical coordinates. A rotation matrix for the azimuth angle is provided, but the user struggles with directly incrementing theta and phi to achieve the desired rotation. It is noted that simply adding degrees to theta or phi does not yield the expected results when converting to Cartesian coordinates. The conversation also touches on the correct conversion formulas from spherical to Cartesian coordinates. The user seeks clarity on the rotation process and its implications in a Cartesian system.
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 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 31 ·
2
Replies
31
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K