# Rotating a line segment in 3D to a prescribed orientation

I have a general line segment with endpoints $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$ referenced to a 3D Cartesian coordinate frame E. I wish to rotate this coordinate fram E to a new coordinate system F such that the new $x$-axis is parallel to this line segment.

Basically, I am looking for three unique Euler angles $(\alpha,\beta,\gamma)$, using the usual $z-y'-z''$ convention, in terms of the coordinates for the two endpoints in the original coordinate frame. Therefore, in the new coordinate frame, I will have three equations to satisfy: 1. $y_1''' = y_2'''$, 2. $z_1''' = z_2'''$, and 3. $(x_2'''- x_1''')^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2$

• Is the use of Euler angles prescribed for the problem, or would you consider any representation of the rotation (e.g. quaternions)? – Muphrid Jan 9 '13 at 20:40
• Presumably, you want the rotation to be with the origin as the center? – Thomas Andrews Jan 9 '13 at 20:43
• Euler angles are prescribed. Is there a way to go from another representation of the rotation to Euler angles? – user56726 Jan 9 '13 at 20:44
• The origin of the original and transformed coordinate system must be the same. – user56726 Jan 9 '13 at 20:45

It's probably easier to think about this logically, then, rather than directly in terms of spinors/quaternions. Here's what you can do: you're rotating the $\hat x$ vector onto the vector $\hat \ell$. This can be done in a two-step process: rotate $\hat x$ onto $\hat \ell$'s projection onto the xy-plane. This puts $\hat \ell$ on the $zx'$ plane, and only one more rotation is required--rotation about $y'$--to line up $\hat x''$ with $\hat \ell$.