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

llRot2Angle() public method

public llRot2Angle ( Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion rot ) : Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.LSLFloat
rot Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion
return Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.LSLFloat
        public LSL_Float llRot2Angle(LSL_Rotation rot)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_Float();


            if (rot.s > 1) // normalization needed
            {
                double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
                        rot.z * rot.z + rot.s * rot.s);

                if (length == 0)
                    return 0;
                //                rot.x /= length;
                //                rot.y /= length;
                //                rot.z /= length;
                rot.s /= length;
            }

            double angle = 2 * Math.Acos(rot.s);

            return angle;
        }
LSL_Api