public GodotQuat Quat()
        {
            float num1 = x[0] + y[1] + z[2];

            if (num1 > 0.0)
            {
                float num2 = GodotMathf.Sqrt(num1 + 1f) * 2f;
                float num3 = 1f / num2;
                return(new GodotQuat((z[1] - y[2]) * num3, (x[2] - z[0]) * num3, (y[0] - x[1]) * num3, num2 * 0.25f));
            }
            if (x[0] > y[1] && x[0] > z[2])
            {
                float num2 = GodotMathf.Sqrt((float)(x[0] - y[1] - z[2] + 1.0)) * 2f;
                float num3 = 1f / num2;
                return(new GodotQuat(num2 * 0.25f, (x[1] + y[0]) * num3, (x[2] + z[0]) * num3, (z[1] - y[2]) * num3));
            }
            if (y[1] > z[2])
            {
                float num2 = GodotMathf.Sqrt((float)(-x[0] + y[1] - z[2] + 1.0)) * 2f;
                float num3 = 1f / num2;
                return(new GodotQuat((x[1] + y[0]) * num3, num2 * 0.25f, (y[2] + z[1]) * num3, (x[2] - z[0]) * num3));
            }
            float num4 = GodotMathf.Sqrt((float)(-x[0] - y[1] + z[2] + 1.0)) * 2f;
            float num5 = 1f / num4;

            return(new GodotQuat((x[2] + z[0]) * num5, (y[2] + z[1]) * num5, num4 * 0.25f, (y[0] - x[1]) * num5));
        }
        public float Length()
        {
            double num1 = x * (double)x;
            float  num2 = y * y;
            float  num3 = z * z;
            double num4 = num2;

            return(GodotMathf.Sqrt((float)(num1 + num4) + num3));
        }
Example #3
0
        internal void Normalize()
        {
            float s = ((x * x) + (y * y));

            if (s == 0.0)
            {
                return;
            }
            float num = GodotMathf.Sqrt(s);

            x /= num;
            y /= num;
        }
Example #4
0
 public float Length()
 {
     return(GodotMathf.Sqrt(LengthSquared()));
 }
Example #5
0
 public float Length()
 {
     return(GodotMathf.Sqrt((x * x) + (y * y)));
 }
Example #6
0
 public float DistanceTo(GodotVector2 to)
 {
     return(GodotMathf.Sqrt(((x - to.x) * (x - to.x)) + ((y - to.y) * (y - to.y))));
 }