Euler4 ToEulerInHalfSingularity()
{
if (ex.x < 0)
{
// 90 deg of X, U, V
}
else if (ey.y < 0)
{
if (ez.z < 0)
{
return(new Euler4(0, Utility.Atan2(ey.z, ey.y) * Math.Rad2Deg)); // X
}
if (ew.w < 0)
{
return(new Euler4(4, Utility.Atan2(ew.y, ey.y) * Math.Rad2Deg)); // U
}
}
else if (ez.z < 0 && ew.w < 0)
{
return(new Euler4(5, Utility.Atan2(ew.z, ez.z) * Math.Rad2Deg)); // V
}
// (all diag is positive)
return(new Euler4(Math.Asin(ey.z), Math.Asin(ez.x), Math.Asin(ex.y),
Math.Asin(ew.x), Math.Asin(ew.y), Math.Asin(ew.z)) * Math.Rad2Deg);
}