3D Coordinate transformation and Euler Angles

In summary, the author is trying to find the moment of inertia tensor of all the particles in a galaxy and use this to find the principal axes. He then wants to "view" the galaxy looking along this principal axis. However, rotation matrices do not commute, so he needs to find α, β, and γ such that z' will align with an arbitrary v.
  • #1
clandarkfire
31
0
Hello,

I'm running a galaxy formation simulation. The output specifies the coordinates in (x, y, z) of all the particles in a galaxy, which usually fall in a disk. The orientation of the disk depends on the initial conditions, but it is generally not aligned with any of the coordinate axes.

I'm trying to write a function that will allow me to view the disk face on, rather than along one of the coordinate axes. E.g., I can view the galaxy along the z-axis by plotting x vs y for all particles, but unless the galaxy is in the x-y plane, I look at it at some arbitrary angle.

Right now, I'm finding the moment of inertia tensor of all the particles in the galaxy and using this to find the principal axes. As I would expect, the principal axis corresponding the the largest eigenvalue (e.g., moment) is a vector perpendicular to the disk.

Now I would like to "view" the galaxy looking along this principal axis. That is, I want to rotate my coordinate axes so that the z' axis is aligned with the principal axis. This will give all my particles new coordinates (x', y', and z'), and plotting (x' vs y') should show the disk face-on.

I know how to do this transformation using rotation matrices in terms of the angles α, β, and γ that I rotate around the x, y, and z axes, or in terms of the Euler angles. But for the life of me, I can't figure out how to properly find these angles if I want the z' axis to be aligned with the principal axis, say v = (v_x, v_y, v_z). My original thought was to set α=0 and then set β to the polar angle, given by β=v_z/sqrt(v_x^2 + v_y^2 + v_z^2). Finally, I'd set γ to the azimuthal angle.

This works if v is in the x-y, x-z, or y-z planes. But for an arbitrary v, it doesn't, because these rotations don't commute.

So how can I find α, β, and γ such that z' will align with an arbitrary v?

Thanks so much!
 
Physics news on Phys.org
  • #2
clandarkfire said:
I can't figure out how to properly find these angles if I want the z' axis to be aligned with the principal axis
Do you actually need the angles? You can build the rotation matrix directly from the new base vectors. But you need all 3 of them, not just z'. Your problem is undetermined as stated now.
 
  • Like
Likes clandarkfire
  • #3
A.T. said:
Do you actually need the angles? You can build the rotation matrix directly from the new base vectors. But you need all 3 of them, not just z'. Your problem is undetermined as stated now.
That would work too, but I'm not sure how I would go about building the rotation matrix from the principal axes -- I always learned rotations in terms of angles.
 
Last edited:
  • #4
clandarkfire said:
but I'm not sure how I would go about building the rotation matrix from the principal axes
The base vectors of your target system are the rows of the matrix R, then p' = R * p.
 
  • Like
Likes clandarkfire
  • #5
A.T. said:
The base vectors of your target system are the rows of the matrix R, then p' = R * p.
Oh gosh, that's much easier that I was thinking. It's been too long since I took linear algebra.

Thanks a million!
 

FAQ: 3D Coordinate transformation and Euler Angles

1. What is the purpose of 3D coordinate transformation in Euler angles?

3D coordinate transformation in Euler angles is used to describe the orientation and rotation of an object in a 3D space. It allows for the conversion of coordinates from one reference frame to another, making it easier to understand the position and movement of an object.

2. How many types of Euler angles are there and what are their differences?

There are three types of Euler angles: roll, pitch, and yaw. Roll measures rotation around the x-axis, pitch measures rotation around the y-axis, and yaw measures rotation around the z-axis. These angles are measured in degrees or radians and can be used together to fully describe the orientation of an object.

3. What are the advantages of using Euler angles for 3D rotation?

Euler angles offer a simple and intuitive way to describe 3D rotations. They can also be easily visualized and understood by humans, making them useful for tasks such as animation and robotics. Additionally, they can be easily converted to and from other rotation representations, making them versatile for different applications.

4. What are some common challenges when working with 3D coordinate transformation and Euler angles?

One common challenge is the issue of gimbal lock, which occurs when two of the axes align and result in a loss of one degree of freedom. This can cause unexpected behavior in animations and robotics. Another challenge is the order of rotations, as the sequence of rotations around different axes can affect the final orientation of an object.

5. How are 3D coordinate transformation and Euler angles used in real-world applications?

3D coordinate transformation and Euler angles are widely used in various industries such as aerospace, robotics, and computer graphics. They are essential for tasks such as flight navigation, object tracking, and 3D animation. They are also used in virtual reality and video games to accurately represent the movement and orientation of objects in a 3D space.

Similar threads

Replies
1
Views
1K
Replies
1
Views
896
Replies
6
Views
997
Replies
1
Views
1K
Replies
7
Views
2K
Replies
3
Views
2K
Back
Top