Beispiel #1
0
        /// <summary>
        /// 夹角大小
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static LFloat Angle(LQuaternion a, LQuaternion b)
        {
            LFloat single = Dot(a, b);

            return(LMath.Acos(LMath.Min(LMath.Abs(single), LFloat.one)) * 2 * (180 / LMath.PI));
        }
Beispiel #2
0
 public static LVector2 Lerp(LVector2 a, LVector2 b, LFloat f)
 {
     return(new LVector2(true,
                         (int)(((long)(b._x - a._x) * f._val) / LFloat.Precision) + a._x,
                         (int)(((long)(b._y - a._y) * f._val) / LFloat.Precision) + a._y));
 }
Beispiel #3
0
 public static LFloat Sqrt(LFloat val)
 {
     return(LockStep.Math.LMath.Sqrt(val));
 }
Beispiel #4
0
 public static LFloat Max(LFloat a, LFloat b)
 {
     return(new LFloat(true, Max(a._val, b._val)));
 }
Beispiel #5
0
 public static LFloat Lerp(LFloat a, LFloat b, LFloat f)
 {
     return(new LFloat(true, (int)(((long)(b._val - a._val) * f._val) / LFloat.Precision) + a._val));
 }
Beispiel #6
0
 public static bool SameSign(LFloat a, LFloat b)
 {
     return((long)a._val * b._val > 0L);
 }
Beispiel #7
0
 /// <summary>
 /// 返回正负值
 /// </summary>
 /// <param name="a"></param>
 /// <returns></returns>
 public static int Sign(LFloat a)
 {
     return(System.Math.Sign(a._val));
 }
Beispiel #8
0
 public static LFloat Atan2(LFloat y, LFloat x)
 {
     return(Atan2(y._val, x._val));
 }
Beispiel #9
0
 /// <summary>
 /// 平方
 /// </summary>
 /// <param name="a"></param>
 /// <returns></returns>
 public static LFloat Sqr(LFloat a)
 {
     return(a * a);
 }
Beispiel #10
0
        public static LFloat Cos(LFloat radians)
        {
            int index = LUTSinCos.getIndex(radians);

            return(new LFloat(true, (long)LUTSinCos.cos_table[index] / 10));
        }
Beispiel #11
0
        public static LFloat Sin(LFloat val)
        {
            int index = LUTSinCos.getIndex(val);

            return(new LFloat(true, (long)LUTSinCos.sin_table[index] / 10));
        }
Beispiel #12
0
 public LVector2(LFloat x, LFloat y)
 {
     this._x = x;
     this._y = y;
 }
Beispiel #13
0
 public LVector3(LFloat _x, LFloat _y, LFloat _z)
 {
     this._x = _x._val;
     this._y = _y._val;
     this._z = _z._val;
 }
Beispiel #14
0
 public static LFloat Sqrt(LFloat val)
 {
     return(LMath.Sqrt(val));
 }