Example #1
0
        public static int AcosFast(int x)
        {
            // Return 0 for invalid values
            if (x < -One || x > One)
            {
                FixedUtil.InvalidArgument("Fixed32.AcosFast", "x", x);
                return(0);
            }

            // Compute Atan2(Sqrt((1+x) * (1-x)), x), using s32.32.
            long xx = (long)(One + x) * (long)(One - x);
            long y  = Fixed64.SqrtFast(xx);

            return((int)(Fixed64.Atan2Fast(y, (long)x << 16) >> 16));
        }
Example #2
0
 public static F64 LengthFast(F64Vec4 a)
 {
     return(F64.FromRaw(Fixed64.SqrtFast(Fixed64.Mul(a.RawX, a.RawX) + Fixed64.Mul(a.RawY, a.RawY) + Fixed64.Mul(a.RawZ, a.RawZ) + Fixed64.Mul(a.RawW, a.RawW))));
 }
Example #3
0
 public static F64Vec4 SqrtFast(F64Vec4 a)
 {
     return(new F64Vec4(Fixed64.SqrtFast(a.RawX), Fixed64.SqrtFast(a.RawY), Fixed64.SqrtFast(a.RawZ), Fixed64.SqrtFast(a.RawW)));
 }
Example #4
0
 public static F64Vec3 SqrtFast(F64Vec3 a)
 {
     return(new F64Vec3(Fixed64.SqrtFast(a.RawX), Fixed64.SqrtFast(a.RawY), Fixed64.SqrtFast(a.RawZ)));
 }
Example #5
0
 public static F64 SqrtFast(F64 a)
 {
     return(FromRaw(Fixed64.SqrtFast(a.Raw)));
 }
Example #6
0
 public static F64Vec2 SqrtFast(F64Vec2 a)
 {
     return(new F64Vec2(Fixed64.SqrtFast(a.RawX), Fixed64.SqrtFast(a.RawY)));
 }
Example #7
0
 public static F64 LengthFast(F64Vec2 a) { return F64.FromRaw(Fixed64.SqrtFast(Fixed64.Mul(a.RawX, a.RawX) + Fixed64.Mul(a.RawY, a.RawY))); }
Example #8
0
 public static F32 LengthFast(F32Vec3 a)
 {
     return(F32.FromRaw((int)(Fixed64.SqrtFast((long)a.RawX * (long)a.RawX + (long)a.RawY * (long)a.RawY + (long)a.RawZ * (long)a.RawZ) >> 16)));
 }