예제 #1
0
        /// <summary>
        /// 获取两点间的距离
        /// </summary>
        /// <returns></returns>
        public static int GetLenght(MPoint p1, MPoint p2)
        {
            int x = p1.X - p2.X;
            int y = p1.Y - p2.Y;

            return((int)Math.Sqrt((double)(x * x) + (double)(y * y)));
        }
예제 #2
0
        /// <summary>
        /// 根据百分比获取两个点直接的百分比的坐标值
        /// </summary>
        /// <param name="rate"></param>
        /// <param name="p1"></param>
        /// <param name="p2"></param>
        /// <returns></returns>
        public MPoint GetMP(double rate, MPoint p1, MPoint p2)
        {
            int x = ((int)((double)rate * (p2.X - p1.X)) + p1.X);
            int y = ((int)((double)rate * (p2.Y - p1.Y)) + p1.Y);

            return(new MPoint(x, y));
        }
예제 #3
0
 public void AddPoint(MPoint point)
 {
     point.ID = _points.Count();
     _points.Add(point);
     if (_points.Count > 1)
     {
         Lenght = Lenght + Line.GetLenght(_points[_points.Count() - 2], _points[_points.Count() - 1]);
     }
 }