Rotate Points on Sphere by Theta and Phi

Click For Summary

Discussion Overview

The discussion revolves around the challenge of rotating points on a sphere using spherical coordinates defined by angles theta and phi. Participants explore the mathematical and conceptual aspects of performing such rotations, particularly focusing on the use of rotation matrices and the necessary parameters for defining rotations in three-dimensional space.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • The original poster (OP) seeks to rotate points on a sphere defined by specific theta and phi values, but has encountered difficulties with the rotation matrix.
  • Some participants emphasize that a general rotation in three dimensions typically requires three angles, not just two, and suggest that the OP clarify their understanding of the rotation process.
  • Others argue that the OP may only need to consider a limited set of rotations defined by two angles, depending on the context of the problem.
  • There is a discussion about the ambiguity in the OP's request, particularly regarding whether the angles provided correspond to points on the sphere or actual rotations.
  • The OP shares their attempts at implementing a rotation using a loop and Euler-Rodrigues formula, but expresses confusion about the results being too far from the intended angles.
  • Some participants question the clarity of the OP's approach and the definitions used for theta and phi, suggesting that the OP's calculations may not align with standard conventions.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the necessity of three angles for rotation versus the possibility of using just two angles for specific cases. The discussion remains unresolved regarding the OP's specific needs and the correct interpretation of the angles involved.

Contextual Notes

There are unresolved questions about the definitions of theta and phi as used by the OP, as well as the assumptions underlying the rotation process. The discussion highlights potential misunderstandings regarding the mathematical framework for rotations in three-dimensional space.

James_1978
Messages
34
Reaction score
3
Dear Forum,

My goal is to rotate several points on a sphere by a theta and phi. For example, I have a sphere where the elevation is theta (90 to -90) and the azimuthal is phi (-180 to 180). I have the following points on the sphere:

theta = [45 45 45 45]
phi = [-180 90 90 180]

This generate several points to define a circle on the top of the circle. My goal is to rotate the four points by theta 115 (or theta = -25) and phi 160. With this the center of the circle will have the vector (theta=115,phi=160) and the four points will be around the center and new theta,phi locations.

I have been unsuccessful trying trying to do this with a rotation matrix. I appreciate any ideas to help me solve this problem.

Regards,
JC
 
Physics news on Phys.org
James_1978 said:
I have been unsuccessful trying trying to do this with a rotation matrix.
Please show us what you have tried. That not only saves us from repeating things you know, but also gives us an idea of any misunderstandings you may have.

Also note that a rotation in three dimensions generally is parametrised by three angles, not two. This can be seen from rotating one point on the sphere to another (this requires two angles) and then you have the freedom to rotate around the axis of the sphere containing that point. Typically, Euler angles would be used.

There are also always two fixed points of any rotation so saying that you generally want to rotate points by some ##\theta## and ##\phi## is not really a good description of a rotation. You need three angles to define a rotation - the axis of rotation can be specified by two and then you need an angle of rotation.
 
  • Like
Likes   Reactions: FactChecker
Orodruin said:
Please show us what you have tried. That not only saves us from repeating things you know, but also gives us an idea of any misunderstandings you may have.

Also note that a rotation in three dimensions generally is parametrised by three angles, not two. This can be seen from rotating one point on the sphere to another (this requires two angles) and then you have the freedom to rotate around the axis of the sphere containing that point. Typically, Euler angles would be used.

There are also always two fixed points of any rotation so saying that you generally want to rotate points by some ##\theta## and ##\phi## is not really a good description of a rotation. You need three angles to define a rotation - the axis of rotation can be specified by two and then you need an angle of rotation.
Three rotation angles are needed for the general rotation, but if this is a physical object, like a robotic arm, with only 2 axes of rotation then there is no need for a third angle.
 
FactChecker said:
Three rotation angles are needed for the general rotation, but if this is a physical object, like a robotic arm, with only 2 axes of rotation then there is no need for a third angle.
No. This does not have to do with physical objects, but with how robot arms work. A general asymmetric physical object will need three angles to be rotated into any predetermined position.
 
Orodruin said:
No. This does not have to do with physical objects, but with how robot arms work. A general asymmetric physical object will need three angles to be rotated into any predetermined position.
Yes, I agree. But the OP does not say that he has to deal with all possible rotations. It is very likely that he only cares about a reduced set of rotations that can be specified by two angles. In fact, it sounds like he only cares about two specific rotations of specific angles. There are three angles, but he does not have to use all of them.
 
FactChecker said:
Yes, I agree. But the OP does not say that he has to deal with all possible rotations. It is very likely that he only cares about a reduced set of rotations that can be specified by two angles. In fact, it sounds like he only cares about two specific rotations of specific angles. There are three angles, but he does not have to use all of them.
I do not think this can be deduced from the OP alone. In fact, referring to rotations by the spherical coordinates in itself poses questions regarding the understanding of rotations. We will simply not know until the OP returns and clarifies what he intends to do.
 
Orodruin said:
I do not think this can be deduced from the OP alone. In fact, referring to rotations by the spherical coordinates in itself poses questions regarding the understanding of rotations. We will simply not know until the OP returns and clarifies what he intends to do.
The OP says "My goal is to rotate the four points by theta 115 (or theta = -25) and phi 160."
That seems clear to me. He does not mention any roll angle.
 
Last edited:
FactChecker said:
The OP says "My goal is to rotate the four points by theta 115 (or theta = -25) and phi 160."
That seems clear to me.
It most certainly is not in my book. Theta and phi are angles on the sphere according to OP and therefore define a point on the sphere, not a rotation (unless you specify which point should be mapped there and even then there is the remaining ambiguity regarding additional rotations around that axis). While changing all phi angles by a fixed amount does correspond to a rotation, doing the same for theta certainly does not. Hence the request for OP to show what he tried specifically.
James_1978 said:
phi = [-180 90 90 180]
OP, please also note that your first and last points are the same as well as your second and third. If you want four points around the pole, you should include phi=0 and phi =-90.
 
Dear All,

Here is what I have tried. I first make 5 points very close to the top of the pole if you will.

Code:
phi_vals = [-180:90:180]
theta_vals = 1.5*ones(5,1)*(180/pi)

My goal is to rotate these points so that they are projected toward a theta,phi. However, they will be around the center by a ~ 1 degree. I write a loop to generate a v with the different points.

Code:
for i=1:length(phi_vals)

s1 = cosd(phi_vals(i))*sind(theta_vals(i))
s2 = sind(phi_vals(i))*sind(theta_vals(i))
s3 = cosd(theta_vals(i))

rot_theta=116
rot_phi=160

t1 = cosd(rot_phi)*sind(rot_theta)
t2 = sind(rot_phi)*sind(rot_theta)
t3 = cosd(rot_theta)

v = [s1;s2;s3]
axis=[t1;t2;t3]
theta = acos(dot(v,axis));        % angle between vectors

axis = axis/(sqrt(dot(axis,axis)))
a=cos(theta/2)
val = -axis*sin(theta/2)
b=val(1)
c=val(2)
d=val(3)
aa=a*a;bb=b*b;cc=c*c;dd=d*d;
bc=b*c;ad=a*d;ac=a*c;ab=a*b;bd=b*d;cd=c*d;
%%%%  Euler–Rodrigues Rotation %%%%
er_array=[(aa + bb - cc - dd) (2*(bc + ad)) (2*(bd - ac));(2*(bc - ad)) (aa + cc - bb - dd) (2*(cd + ab));(2*(bd + ac)) (2*(cd - ab)) (aa + dd - bb - cc)]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rot_array = er_array*v
[az,el,r]=cart2sph(rot_array(1),rot_array(2),rot_array(3));
rec_phi(i) = az*(180/pi)
rec_theta(i) = 90-el*(180/pi)

My thinking is that I would have five points that very close to theta=116 and phi=160. However, the points are too far a way from 116,160 to make sense. Any idea what I am missing?

I am following this guide
https://en.wikipedia.org/wiki/Euler–Rodrigues_formula
 
  • #10
James_1978 said:
theta_vals = 1.5*ones(5,1)*(180/pi)
Not entirely sure what you are doing here. This will give theta values of ca 85 - i.e., around the equator.

Edit: No wait, you are using inclination instead of the polar angle, yes that will be close to a pole.

Edit 2: No wait again, your formulas indicate that you are using it as the polar angle ...

James_1978 said:
rot_theta=116
rot_phi=160

t1 = cosd(rot_phi)*sind(rot_theta)
t2 = sind(rot_phi)*sind(rot_theta)
t3 = cosd(rot_theta)

v = [s1;s2;s3]
axis=[t1;t2;t3]
theta = acos(dot(v,axis)); % angle between vectors
It is not clear to me what you are trying to do here. You are defining an axis and letting "theta" equal the angle between the defined point and that axis. There are many things awry here.

James_1978 said:
axis = axis/(sqrt(dot(axis,axis)))
You don't need to do this based on your previous code. Your axis is already normalised by construction.

James_1978 said:
a=cos(theta/2)
val = -axis*sin(theta/2)
b=val(1)
c=val(2)
d=val(3)
You seem to be using the axis containing the point you want to rotate to as the rotation axis and the angle between the point and the axis as the rotation angle. This will not work. If you want to rotate the point to theta = 116 and phi = 160, you cannot have that point as the rotation axis because it will make that point a fixed point of the rotation, which means no other point can map to it. You should also not be using different rotations for different points. You need to construct your rotation matrix based on what you want to do, which is to make a single rotation rotating the center of your points to the desired direction and seeing what the rotation does to your other points.

If you take a point on the sphere and want to rotate it to theta = 116 and phi = 160 by using the angle between the vectors as the rotation angle, then your rotation axis needs to be perpendicular to both the target point and the point of origin. You can obtain a perpendicular vector through the cross product.
 
  • #11
Dear Orodruin,

Thank you for the response. I have attached a picture to better explain what I am trying to do. Please let me know if this helps.
 

Attachments

  • 0415221041b.jpg
    0415221041b.jpg
    39.4 KB · Views: 203

Similar threads

  • · Replies 33 ·
2
Replies
33
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K