Aurora.ScriptEngine.AuroraDotNetEngine.APIs.LSL_Api.llRot2Fwd C# (CSharp) Метод

llRot2Fwd() публичный Метод

public llRot2Fwd ( Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion r ) : Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3
r Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion
Результат Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3
        public LSL_Vector llRot2Fwd(LSL_Rotation r)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return new LSL_Vector();


            double m = r.x * r.x + r.y * r.y + r.z * r.z + r.s * r.s;
            // m is always greater than zero
            // if m is not equal to 1 then Rotation needs to be normalized
            if (Math.Abs(1.0 - m) > 0.000001) // allow a little slop here for calculation precision
            {
                m = 1.0 / Math.Sqrt(m);
                r.x *= m;
                r.y *= m;
                r.z *= m;
                r.s *= m;
            }

            // Fast Algebric Calculations instead of Vectors & Quaternions Product
            double x = r.x * r.x - r.y * r.y - r.z * r.z + r.s * r.s;
            double y = 2 * (r.x * r.y + r.z * r.s);
            double z = 2 * (r.x * r.z - r.y * r.s);
            return (new LSL_Vector(x, y, z));
        }
LSL_Api