mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Initial commit
This commit is contained in:
commit
3c7cc0c973
8391 changed files with 704313 additions and 0 deletions
|
@ -0,0 +1,70 @@
|
|||
// -----------------------------------------------------------------------
|
||||
// <copyright file="Vertex.cs">
|
||||
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
|
||||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace UnityEngine.U2D.Animation.TriangleNet
|
||||
.Topology.DCEL
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal class Vertex : Animation.TriangleNet.Geometry.Point
|
||||
{
|
||||
internal HalfEdge leaving;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a half-edge leaving the vertex.
|
||||
/// </summary>
|
||||
public HalfEdge Leaving
|
||||
{
|
||||
get { return leaving; }
|
||||
set { leaving = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Vertex" /> class.
|
||||
/// </summary>
|
||||
/// <param name="x">The x coordinate.</param>
|
||||
/// <param name="y">The y coordinate.</param>
|
||||
public Vertex(double x, double y)
|
||||
: base(x, y)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Vertex" /> class.
|
||||
/// </summary>
|
||||
/// <param name="x">The x coordinate.</param>
|
||||
/// <param name="y">The y coordinate.</param>
|
||||
/// <param name="leaving">A half-edge leaving this vertex.</param>
|
||||
public Vertex(double x, double y, HalfEdge leaving)
|
||||
: base(x, y)
|
||||
{
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates all half-edges leaving this vertex.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<HalfEdge> 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue