public static Polygon2d ByPolygon(Polygon poly)
        {
            Point[]        polyPts = poly.Points;
            List <Point2d> ptList  = new List <Point2d>();

            for (int i = 0; i < polyPts.Length; i++)
            {
                ptList.Add(Point2d.ByCoordinates(polyPts[i].X, polyPts[i].Y));
            }
            return(new Polygon2d(ptList));
        }
        //convert point to point2dList
        internal static List <Point2d> PointtoPoint2D(List <Point> pointList)
        {
            List <Point2d> point2dList = new List <Point2d>();

            for (int i = 0; i < pointList.Count; i++)
            {
                Point2d p2 = Point2d.ByCoordinates(pointList[i].X, pointList[i].Y);
                point2dList.Add(p2);
            }
            pointList.Clear();
            return(point2dList);
        }
        public static List <Point2d> Point2dFromPointList(List <Point> pointList)
        {
            if (pointList == null)
            {
                return(null);
            }

            List <Point2d> ptList = new List <Point2d>();

            for (int i = 0; i < pointList.Count; i++)
            {
                ptList.Add(Point2d.ByCoordinates(pointList[i].X, pointList[i].Y));
            }
            return(ptList);
        }
        public static List <Point2d> Point2dFromRegularPolygon(Polygon poly)
        {
            if (poly == null)
            {
                return(null);
            }

            List <Point> pointList = new List <Point>();

            for (int i = 0; i < poly.Points.Length; i++)
            {
                pointList.Add(Point.ByCoordinates(poly.Points[i].X, poly.Points[i].Y));
            }

            List <Point2d> ptList = new List <Point2d>();

            for (int i = 0; i < pointList.Count; i++)
            {
                ptList.Add(Point2d.ByCoordinates(pointList[i].X, pointList[i].Y));
            }
            return(ptList);
        }