Esempio n. 1
0
        public GodotBasis(GodotVector3 axis, float phi)
        {
            GodotVector3 vector3 = new GodotVector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
            float        num1    = GodotMathf.Cos(phi);
            float        num2    = GodotMathf.Sin(phi);

            x = new GodotVector3(vector3.x + (num1 * (1f - vector3.x)), (float)((axis.x * axis.y * (1.0 - num1)) - (axis.z * num2)), (float)((axis.z * axis.x * (1.0 - num1)) + (axis.y * num2)));
            y = new GodotVector3((float)((axis.x * axis.y * (1.0 - num1)) + (axis.z * num2)), vector3.y + (num1 * (1f - vector3.y)), (float)((axis.y * axis.z * (1.0 - num1)) - (axis.x * num2)));
            z = new GodotVector3((float)((axis.z * axis.x * (1.0 - num1)) - (axis.y * num2)), (float)((axis.y * axis.z * (1.0 - num1)) + (axis.x * num2)), vector3.z + (num1 * (1f - vector3.z)));
        }
Esempio n. 2
0
        public GodotQuat(GodotVector3 axis, float angle)
        {
            float num1 = axis.Length();

            if (num1 == 0.0)
            {
                x = 0.0f;
                y = 0.0f;
                z = 0.0f;
                w = 0.0f;
            }
            else
            {
                float num2 = GodotMathf.Sin(angle * 0.5f) / num1;
                x = axis.x * num2;
                y = axis.y * num2;
                z = axis.z * num2;
                w = GodotMathf.Cos(angle * 0.5f);
            }
        }
Esempio n. 3
0
        public GodotVector2 Rotated(float phi)
        {
            float s = Angle() + phi;

            return(new GodotVector2(GodotMathf.Cos(s), GodotMathf.Sin(s)) * Length());
        }