public SimplePolygon(Vector2[] points)
        {
            if (points.Length < 3)
                throw new ArgumentException("Insufficent vertices.");

            var face = new Face();

            Vertex firstVertex = new Vertex(points[0]);

            this.firstEdge = new HalfEdge();
            firstEdge.Origin = firstVertex;
            firstEdge.Face = face;
            face.ConnectedEdge = firstEdge;

            var previousEdge = firstEdge;
            foreach (var point in points.Skip(1))
            {
                var edge = new HalfEdge();
                edge.Origin = new Vertex(point);
                edge.Face = face;

                edge.Previous = previousEdge;
                previousEdge.Next = edge;

                previousEdge = edge;
            }

            firstEdge.Previous = previousEdge;
            previousEdge.Next = firstEdge;

            if (!PolygonIsSimpleAndHasSortedVertices())
                throw new ArgumentException("Polygon is not simple.");
        }
 public EventPoint(Vertex vertex, IEnumerable<Segment> correspondingSegments)
 {
     this.Vertex = vertex;
     this.CorrespondingSegments = correspondingSegments;
 }
 public EventPoint(Vertex vertex)
 {
     this.Vertex = vertex;
 }
 public int InsertEvent(Vertex newEventPoint)
 {
     eventPoints.Add(new EventPoint(newEventPoint));
     return eventPoints.Count;
 }