Exemple #1
0
 static public void AssertAlmostEqualsAngleRadians(fint fvalue, float f)
 {
     if (Math.Abs(fvalue.ToFloat() - f) > (float)(2.0f * Math.PI / 180.0f))
     {
         throw new Exception(string.Format("Expected {0}, got {1}", f, fvalue.ToFloat().ToString()));
     }
 }
Exemple #2
0
 static public void AssertAlmostEqualsTrig(fint fvalue, float f)
 {
     if (Math.Abs(fvalue.ToFloat() - f) > 0.09f)
     {
         throw new Exception(string.Format("Expected {0}, got {1}", f, fvalue.ToFloat().ToString()));
     }
 }
Exemple #3
0
 static public void AssertEquals(fint fvalue, float f)
 {
     if (fvalue.ToFloat() != f)
     {
         throw new Exception(string.Format("Expected {0}, got {1}", f, fvalue.ToFloat().ToString()));
     }
 }
Exemple #4
0
 static public void AssertEquals(fint fvalue1, fint fvalue2)
 {
     if (fvalue1 != fvalue2)
     {
         throw new Exception(string.Format("Expected {0}, got {1}", fvalue1.ToFloat(), fvalue2.ToFloat()));
     }
 }
Exemple #5
0
        public static fint Asin(fint F)
        {
            bool isNegative = F.raw < 0;

            F = Abs(F);

            if (F > fint.one)
            {
                throw new ArithmeticException("Bad Asin Input:" + F.ToFloat());
            }

            fint f1 = mul(mul(mul(mul(
                                      fint.CreateRaw(145103 >> fint.SHIFT_AMOUNT), F) -
                                  fint.CreateRaw(599880 >> fint.SHIFT_AMOUNT), F) +
                              fint.CreateRaw(1420468 >> fint.SHIFT_AMOUNT), F) -
                          fint.CreateRaw(3592413 >> fint.SHIFT_AMOUNT), F) +
                      fint.CreateRaw(26353447 >> fint.SHIFT_AMOUNT);

            fint f2 = HalfPI - (Sqrt(fint.one - F) * f1);

            return(isNegative ? -f2 : f2);
        }
Exemple #6
0
 public UnityEngine.Vector2 ToVector2()
 {
     return(new UnityEngine.Vector2(x.ToFloat(), y.ToFloat()));
 }
Exemple #7
0
 public UnityEngine.Vector3 ToVector3()
 {
     return(new UnityEngine.Vector3(x.ToFloat(), y.ToFloat(), z.ToFloat()));
 }