# How to get RPY(Roll, Pitch, Yaw) from directional cosines from a 3D vector?

I'm trying to find the pose of an 3D vector in terms of RPY(Roll, Pitch, Yaw). Let's say the two end points of the vector is $$P_0(x_0, y_0, z_0)$$ and $$P_1(x_1, y_1, z_1)$$. So the centered vector I get is $$V(V_x, V_y, V_z) = P_1 - P_0 = (x_1 - x_0, y_1 - y_0, z_1 - z_0)$$

Then $$cos(\alpha) = \frac{V_x}{|V|}\\ cos(\beta) = \frac{V_y}{|V|}\\ cos(\gamma) = \frac{V_z}{|V|}$$

Thus, $$\alpha = cos^{-1}(\frac{V_x}{|V|})\\ \beta = cos^{-1}(\frac{V_y}{|V|})\\ \gamma = cos^{-1}(\frac{V_z}{|V|})$$

Here, I'm assuming $$\alpha = roll,\ \beta = pitch,\ and \ \gamma = yaw$$

Is it the correct way to do this?

• What is RPY ... ? Ah ... Roll, Pitch, Yawl ... – Jean Marie May 27 at 19:16
• Keep in mind that the 3 angles you computed are not independent. And there is no such thing as a roll of a vector. – user58697 May 27 at 19:57