Esempio n. 1
0
        /// <summary>
        /// 如果向量表示点的坐标,计算这个点和指定参数点之间的距离
        /// </summary>
        /// <param name="vec">指定点</param>
        /// <returns></returns>
        public float DistanceOf(Vector2L vec)
        {
            float x1 = (float)System.Math.Pow(X - vec.X, 2);
            float x2 = (float)System.Math.Pow(Y - vec.Y, 2);

            return((float)System.Math.Pow(x1 + x2, 0.5d));
        }
Esempio n. 2
0
        public override bool Equals(object obj)
        {
            if (!(obj is Vector2L))
            {
                return(false);
            }
            Vector2L v2 = (Vector2L)obj;

            return(X == v2.X && Y == v2.Y);
        }
Esempio n. 3
0
 /// <summary>
 /// 向量减法
 /// </summary>
 /// <param name="vec"></param>
 /// <returns></returns>
 public Vector2L RED(Vector2L vec)
 {
     return(new Vector2L(X - vec.X, Y - vec.Y));
 }
Esempio n. 4
0
 /// <summary>
 /// 向量加法
 /// </summary>
 /// <param name="vec"></param>
 /// <returns></returns>
 public Vector2L ADD(Vector2L vec)
 {
     return(new Vector2L(X + vec.X, Y + vec.Y));
 }