I have a problem where I need to find Yaw and Pitch of a 3D vector. Yaw is defined as rotation around Y and pitch is defined as rotation around X in this specific order.

I I have searched for some solutions online, but those assumed a rotation around global axis Y and then a rotation around local axis X. For example, normalizing that vector, then pitch=asin(y) and yaw=asin(x/cos(asin(y)). To give you an ideea look at the following image.

But I am actually interested in rotation around both global axis. Like in the following image. So I have come up with my own formulas and I would like to know if they are correct.

$a=\sqrt{x^2 + ||V||^{2}}$

$pitch = asin(z/a) * sign(y)$

$\rho = asin(a/||V||)$

if z < 0 then $yaw = (\pi /2 - \rho) * sign(x)$

if z > 0 then $yaw = (\pi / 2 + \rho) * sign(x)$

Thanks for your help


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.