Aurora.ScriptEngine.AuroraDotNetEngine.APIs.LSL_Api.llRot2Euler C# (CSharp) Method

llRot2Euler() public method

public llRot2Euler ( Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion r ) : Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3
r Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion
return Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3
        public LSL_Vector llRot2Euler(LSL_Rotation r)
        {
            //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
            LSL_Rotation t = new LSL_Rotation(r.x * r.x, r.y * r.y, r.z * r.z, r.s * r.s);
            double m = (t.x + t.y + t.z + t.s);
            if (m == 0) return new LSL_Vector();
            double n = 2 * (r.y * r.s + r.x * r.z);
            double p = m * m - n * n;
            if (p > 0)
                return new LSL_Vector(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s)),
                                             Math.Atan2(n, Math.Sqrt(p)),
                                             Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)));
            if (n > 0)
                return new LSL_Vector(0.0, Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z));
            return new LSL_Vector(0.0, -Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z));
        }
LSL_Api