// ----------------------------------------------------------------------- // // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ // // ----------------------------------------------------------------------- namespace UnityEngine.U2D.Animation.TriangleNet .Geometry { using System; /// /// Represents a straight line segment in 2D space. /// internal class Segment : ISegment { Vertex v0; Vertex v1; int label; /// /// Gets or sets the segments boundary mark. /// public int Label { get { return label; } set { label = value; } } /// /// Gets the first endpoints index. /// public int P0 { get { return v0.id; } } /// /// Gets the second endpoints index. /// public int P1 { get { return v1.id; } } /// /// Initializes a new instance of the class. /// public Segment(Vertex v0, Vertex v1) : this(v0, v1, 0) { } /// /// Initializes a new instance of the class. /// public Segment(Vertex v0, Vertex v1, int label) { this.v0 = v0; this.v1 = v1; this.label = label; } /// /// Gets the specified segment endpoint. /// /// The endpoint index (0 or 1). /// public Vertex GetVertex(int index) { if (index == 0) { return v0; } if (index == 1) { return v1; } throw new IndexOutOfRangeException(); } /// /// WARNING: not implemented. /// public ITriangle GetTriangle(int index) { throw new NotImplementedException(); } } }