Ejemplo n.º 1
0
 public Polygon2D(Vector2List polygonPointsList)
 {
     foreach (Vector2 v in polygonPointsList.points)
     {
         AddPoint(v.x, v.y);
     }
 }
Ejemplo n.º 2
0
        static public List <Pair2> GetList(Vector2List list, bool connect = true)
        {
            List <Pair2> pairsList = new List <Pair2>();

            if (list.points.Count > 0)
            {
                Vector2?p0 = null;

                if (connect == true)
                {
                    p0 = list.points.Last();
                }

                foreach (Vector2 p1 in list.points)
                {
                    if (p0 != null)
                    {
                        pairsList.Add(new Pair2(p0.Value, p1));
                    }

                    p0 = p1;
                }
            }
            return(pairsList);
        }
Ejemplo n.º 3
0
        public Vector2List Copy()
        {
            Vector2List list = new Vector2List(true);

            foreach (Vector2 p in points)
            {
                list.Add(p);
            }
            return(list);
        }
Ejemplo n.º 4
0
        static public List <DoublePair2> GetList(Vector2List list, bool connect = true)
        {
            List <DoublePair2> pairsList = new List <DoublePair2>();

            if (list.Count() > 0)
            {
                int count = list.points.Count;
                for (int i = 0; i < count; i++)
                {
                    int indexB = i;
                    int indexA = ((i + count) - 1) % count;
                    int indexC = (i + 1) % count;

                    pairsList.Add(new DoublePair2(list.points[indexA], list.points[indexB], list.points[indexC]));
                }
            }
            return(pairsList);
        }