libs/math/Quaternion/Quaternion.cpp
// This method takes an euler rotation in rad and converts it to an equivilent 
// Quaternion rotation.
// 800B
This method takes an euler rotation in rad and converts it to an equivilent
Quaternion rotation.
800B
This method takes an euler rotation in rad and converts it to an equivilent Quaternion rotation . 800B
const Quaternion Quaternion::from_euler_rotation(float yaw, float pitch, float roll) {
    float cy = cos(yaw/2);
    float cp = cos(pitch/2);
    float cr = cos(roll/2);
    float sy = sin(yaw/2);
    float sp = sin(pitch/2);
    float sr = sin(roll/2);
    Quaternion ret;
    ret.a = cr * cp * cy + sr * sp * sy;
    ret.b = sr * cp * cy - cr * sp * sy;
    ret.c = cr * sp * cy + sr * cp * sy;
    ret.d = cr * cp * sy - sr * sp * cy;
    return ret;
}
const Quaternion Quaternion :: from_euler_rotation ( float yaw , float pitch , float roll ) { float cy = cos ( yaw / 2 ) ; float cp = cos ( pitch / 2 ) ; float cr = cos ( roll / 2 ) ; float sy = sin ( yaw / 2 ) ; float sp = sin ( pitch / 2 ) ; float sr = sin ( roll / 2 ) ; Quaternion ret ; ret . a = cr * cp * cy + sr * sp * sy ; ret . b = sr * cp * cy - cr * sp * sy ; ret . c = cr * sp * cy + sr * cp * sy ; ret . d = cr * cp * sy - sr * sp * cy ; return ret ; }
This method takes an euler rotation in rad and converts it to an equivilent
Quaternion rotation.
This method takes an euler rotation in rad and converts it to an equivilent Quaternion rotation .