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

I'm trying to find the pose of an 3D vector in terms of RPY. Let's say the two end points of the vector is P0(x0, y0, z0) and P1(x1, y1, z1). So the centered vector I get is V(Vx, Vy, Vz) = P1 - P0 = (x1 - x0, y1 - y0, z1 - z0)

Then

 cos(alpha) = Vx/|V|
cos(beta) = Vy/|V|
cos(gamma) = Vz/|V|


Thus,

  alpha = cos^-1(Vx/|V|)
beta = cos^-1(Vy/|V|)
gamma = cos^-1(Vz/|V|)


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

Is it the correct way to calculate RPY from a 3D vector?

Note: I know this question is more suited for math.stackexchange but assuming more developers probably have gone through this, I'm posting it here.

• Your pose is not well defined, because you can still rotate any arbitrary amount around the vector you gave, so there will be infinitely many RPY representations which you could use. May 28 '19 at 10:05