3D Coordinate transformation and Euler Angles

AI Thread Summary
The discussion revolves around the challenge of transforming 3D coordinates to align with the principal axis of a galaxy disk for visualization purposes. The user is attempting to rotate their coordinate system so that the z' axis aligns with the principal axis derived from the moment of inertia tensor. While they initially considered using Euler angles for the transformation, they encountered difficulties due to the non-commutativity of rotations for arbitrary vectors. An alternative approach suggested involves constructing the rotation matrix directly from the new base vectors, simplifying the process. The user expresses relief at this more straightforward method, indicating a return to foundational concepts in linear algebra.
clandarkfire
Messages
31
Reaction score
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
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
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:
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
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!
 
Thread 'Gauss' law seems to imply instantaneous electric field propagation'
Imagine a charged sphere at the origin connected through an open switch to a vertical grounded wire. We wish to find an expression for the horizontal component of the electric field at a distance ##\mathbf{r}## from the sphere as it discharges. By using the Lorenz gauge condition: $$\nabla \cdot \mathbf{A} + \frac{1}{c^2}\frac{\partial \phi}{\partial t}=0\tag{1}$$ we find the following retarded solutions to the Maxwell equations If we assume that...
Thread 'A scenario of non-uniform circular motion'
(All the needed diagrams are posted below) My friend came up with the following scenario. Imagine a fixed point and a perfectly rigid rod of a certain length extending radially outwards from this fixed point(it is attached to the fixed point). To the free end of the fixed rod, an object is present and it is capable of changing it's speed(by thruster say or any convenient method. And ignore any resistance). It starts with a certain speed but say it's speed continuously increases as it goes...
Maxwell’s equations imply the following wave equation for the electric field $$\nabla^2\mathbf{E}-\frac{1}{c^2}\frac{\partial^2\mathbf{E}}{\partial t^2} = \frac{1}{\varepsilon_0}\nabla\rho+\mu_0\frac{\partial\mathbf J}{\partial t}.\tag{1}$$ I wonder if eqn.##(1)## can be split into the following transverse part $$\nabla^2\mathbf{E}_T-\frac{1}{c^2}\frac{\partial^2\mathbf{E}_T}{\partial t^2} = \mu_0\frac{\partial\mathbf{J}_T}{\partial t}\tag{2}$$ and longitudinal part...

Similar threads

Back
Top