// ----------------------------------------------------------------------- // // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ // // ----------------------------------------------------------------------- namespace UnityEngine.U2D.Animation.TriangleNet .Topology.DCEL { using System.Collections.Generic; internal class Vertex : Animation.TriangleNet.Geometry.Point { internal HalfEdge leaving; /// /// Gets or sets a half-edge leaving the vertex. /// public HalfEdge Leaving { get { return leaving; } set { leaving = value; } } /// /// Initializes a new instance of the class. /// /// The x coordinate. /// The y coordinate. public Vertex(double x, double y) : base(x, y) { } /// /// Initializes a new instance of the class. /// /// The x coordinate. /// The y coordinate. /// A half-edge leaving this vertex. public Vertex(double x, double y, HalfEdge leaving) : base(x, y) { this.leaving = leaving; } /// /// Enumerates all half-edges leaving this vertex. /// /// public IEnumerable EnumerateEdges() { var edge = this.Leaving; int first = edge.ID; do { yield return edge; edge = edge.Twin.Next; } while (edge.ID != first); } public override string ToString() { return string.Format("V-ID {0}", base.id); } } }