// -----------------------------------------------------------------------
//
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
//
// -----------------------------------------------------------------------
namespace UnityEngine.U2D.Animation.TriangleNet
.Topology.DCEL
{
internal class HalfEdge
{
internal int id;
internal int mark;
internal Vertex origin;
internal Face face;
internal HalfEdge twin;
internal HalfEdge next;
///
/// Gets or sets the half-edge id.
///
public int ID
{
get { return id; }
set { id = value; }
}
public int Boundary
{
get { return mark; }
set { mark = value; }
}
///
/// Gets or sets the origin of the half-edge.
///
public Vertex Origin
{
get { return origin; }
set { origin = value; }
}
///
/// Gets or sets the face connected to the half-edge.
///
public Face Face
{
get { return face; }
set { face = value; }
}
///
/// Gets or sets the twin of the half-edge.
///
public HalfEdge Twin
{
get { return twin; }
set { twin = value; }
}
///
/// Gets or sets the next pointer of the half-edge.
///
public HalfEdge Next
{
get { return next; }
set { next = value; }
}
///
/// Initializes a new instance of the class.
///
/// The origin of this half-edge.
public HalfEdge(Vertex origin)
{
this.origin = origin;
}
///
/// Initializes a new instance of the class.
///
/// The origin of this half-edge.
/// The face connected to this half-edge.
public HalfEdge(Vertex origin, Face face)
{
this.origin = origin;
this.face = face;
// IMPORTANT: do not remove the (face.edge == null) check!
if (face != null && face.edge == null)
{
face.edge = this;
}
}
public override string ToString()
{
return string.Format("HE-ID {0} (Origin = VID-{1})", id, origin.id);
}
}
}