Пример #1
0
 /// <summary>
 /// 点乘
 /// </summary>
 /// <param name="u"></param>
 /// <param name="v"></param>
 /// <returns></returns>
 public static LFloat Dot2D(LVector2 u, LVector2 v)
 {
     return(new LFloat(true, ((long)u._x * v._x + (long)u._y * v._y) / LFloat.Precision));
 }
Пример #2
0
        //public static LFloat Dot(LVector3 lhs, LVector3 rhs)
        //{
        //    var val = ((long)lhs._x) * rhs._x + ((long)lhs._y) * rhs._y + ((long)lhs._z) * rhs._z;
        //    return new LFloat(true, val / LFloat.Precision);
        //}
        //public static LVector3 Cross(LVector3 lhs, LVector3 rhs)
        //{
        //    return new LVector3(true,
        //        ((long)lhs._y * rhs._z - (long)lhs._z * rhs._y) / LFloat.Precision,
        //        ((long)lhs._z * rhs._x - (long)lhs._x * rhs._z) / LFloat.Precision,
        //        ((long)lhs._x * rhs._y - (long)lhs._y * rhs._x) / LFloat.Precision
        //    );
        //}

        /// <summary>
        /// 叉乘结果 的模长
        /// </summary>
        /// <param name="u"></param>
        /// <param name="v"></param>
        /// <returns></returns>
        public static LFloat Cross2D(LVector2 u, LVector2 v)
        {
            return(new LFloat(true, ((long)u._x * v._y - (long)u._y * v._x) / LFloat.Precision));
        }
Пример #3
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));
 }
Пример #4
0
 public static LFloat Cross(LVector2 a, LVector2 b)
 {
     return(new LFloat(true, ((long)a._x * (long)b._y - (long)a._y * (long)b._x) / LFloat.Precision));
 }
Пример #5
0
 public void Max(ref LVector2 r)
 {
     this._x = LMath.Max(this._x, r._x);
     this._y = LMath.Max(this._y, r._y);
 }
Пример #6
0
 public static LVector2 Max(LVector2 a, LVector2 b)
 {
     return(new LVector2(true, LMath.Max(a._x, b._x), LMath.Max(a._y, b._y)));
 }