Total chaos in Euler Rotation convention (closed)
Posted: Tue Feb 28, 2017 1:49 am
There is a total convention chaos, sometimes the arguments are called pitch-yaw-roll sometimes pitch-roll-yaw etc.
Please clean this up, and say rotationAboutX, rotationAboutY, rotationAboutZ and clarify all rotations are anti-clockwise around the axis and XYZ is a right-handed system with rotation around the z axis occuring first, y second and x third
All below is untrue and irrelevant to Irrlicht 1.8.4 (my bad, my bug)
I fixed the set() function which has been shrouded by _IRR_TEST_BROKEN_QUATERION_USE_
P.S. Personally I will remove all mention of P-Y-R and euler angles and require quaternion use throughout, and the only way to set euler angles will be just in the quaternion constructor!
Please clean this up, and say rotationAboutX, rotationAboutY, rotationAboutZ and clarify all rotations are anti-clockwise around the axis and XYZ is a right-handed system with rotation around the z axis occuring first, y second and x third
All below is untrue and irrelevant to Irrlicht 1.8.4 (my bad, my bug)
I fixed the set() function which has been shrouded by _IRR_TEST_BROKEN_QUATERION_USE_
Code: Select all
// sets new quaternion based on euler angles
inline quaternion& quaternion::set(const float& roll, const float& pitch, const float& yaw)
{
f64 angle;
angle = roll * 0.5;
const f64 sr = sin(angle);
const f64 cr = cos(angle);
angle = pitch * 0.5;
const f64 sp = sin(angle);
const f64 cp = cos(angle);
angle = yaw * 0.5;
const f64 sy = sin(angle);
const f64 cy = cos(angle);
const f64 cpcy = cp * cy;
const f64 spcy = sp * cy;
const f64 cpsy = cp * sy;
const f64 spsy = sp * sy;
*reinterpret_cast<vectorSIMDf*>(this) = vectorSIMDf(sr,cr,cr,cr)*vectorSIMDf(cpcy,spcy,cpsy,cpcy)+vectorSIMDf(-cr,sr,-sr,sr)*vectorSIMDf(spsy,cpsy,spcy,spsy);
return *this;
}