Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Rotation matrix for azimuth and zenith angles

  1. Jun 23, 2010 #1
    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?.
  2. jcsd
  3. Jun 25, 2010 #2
    Why don't you increment θ and φ as you wish then convert to Cartesian?
  4. Jun 25, 2010 #3
    If you change θ and φ in spherical coordinates and convert to Cartesian, it wont result in the change you expect. It gives garbage values.
    i.e I cant just add 5 degree to θ or φ, if i want to rotate the shape 5 degree.
  5. Jun 25, 2010 #4
    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 = [tex]\sin(\alpha)[/tex];
    calf = [tex]\cos(\alpha)[/tex];


    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: Apr 25, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook