예제 #1
0
        /*Point2D FirstPoint { get { return BasicEdges.First().PointInBoth(BasicEdges.Last()); } }*/

        public List <Point2D> GetActualPointsInWindingOrder()
        {
            List <Point2D> points = new List <Point2D>();

            Edge2D  first      = BasicEdges.First();
            Edge2D  last       = BasicEdges.Last();
            Point2D firstPoint = first.PointInBoth(last);

            points.Add(firstPoint);
            foreach (var currect in BasicEdges)//.Skip(1).Take(BasicEdges.Count - 2))
            {
                currect.AddAllMiddlePoints(points);

                Point2D nextPoint = currect.PointOnlyInThis(last);
                if (nextPoint == firstPoint)
                {
                    break;
                }
                points.Add(nextPoint);

                last = currect;
            }

            return(points);
        }
예제 #2
0
        private List <Point2D> DivideBasicEdges()
        {
            List <Point2D> points = new List <Point2D>();

            Edge2D  first      = BasicEdges.First();
            Edge2D  last       = BasicEdges.Last();
            Point2D firstPoint = first.PointInBoth(last);

            points.Add(firstPoint);
            foreach (var currect in BasicEdges)//.Skip(1).Take(BasicEdges.Count - 2))
            {
                //currect.OnDivide();
                points.Add(currect.OnDivide());

                Point2D nextPoint = currect.PointOnlyInThis(last);
                if (nextPoint == firstPoint)
                {
                    break;
                }
                points.Add(nextPoint);

                last = currect;
            }

            return(points);
        }
예제 #3
0
        private List <Point2D> GetBasiclPointsInWindingOrder()
        {
            //return Edges.SelectMany(e => e.Points).Distinct().ToList();
            List <Point2D> points = new List <Point2D>();
            // The edges were added in order, but we don't know if the points within the edges are in order.
            // Therefore we look at the previous edge to figoure out which point has already been visited

            Edge2D previous = BasicEdges.First();

            foreach (var current in BasicEdges.Skip(1).Take(BasicEdges.Count - 2))
            {
                if (points.Count == 0)
                {
                    Point2D firstPoint = previous.PointOnlyInThis(current);
                    points.Add(firstPoint);

                    Point2D secondPoint = previous.PointInBoth(current);
                    points.Add(secondPoint);
                }

                Point2D nextPoint = current.PointOnlyInThis(previous);
                points.Add(nextPoint);

                previous = current;
            }

            return(points);
        }