Add information about edges

This commit is contained in:
Kacper Donat 2019-08-15 23:01:51 +02:00
parent 945b639dbd
commit fdd3fb35c5

View File

@ -33,7 +33,8 @@ namespace Assets.Voronoi
{
public Point Point { get; internal set; }
public int Index { get; internal set; }
public ISet<int> Vertices { get; internal set; } = new HashSet<int>();
public List<int> Vertices { get; internal set; } = new List<int>();
public List<(int, int)> Edges { get; internal set; } = new List<(int, int)>();
public Site(Point point, int index)
{
@ -144,20 +145,26 @@ namespace Assets.Voronoi
node.Value.Site.Vertices.Add(index);
previous?.Value.Site.Vertices.Add(index);
next?.Value.Site.Vertices.Add(index);
next?.Value.Site.Vertices.Insert(0, index);
if (node.Value.LeftEdge.IsComplete)
{
var (a, b) = node.Value.LeftEdge.Edge;
var edge = node.Value.LeftEdge.Edge;
node.Value.Site.Edges.Insert(0, edge);
previous?.Value.Site.Edges.Add(edge);
Voronoi.AddEdge(a, b);
Voronoi.AddEdge(edge.Item1, edge.Item2);
}
if (node.Value.RightEdge.IsComplete)
{
var (a, b) = node.Value.RightEdge.Edge;
var edge = node.Value.RightEdge.Edge;
node.Value.Site.Edges.Add(edge);
next?.Value.Site.Edges.Insert(0, edge);
Voronoi.AddEdge(a, b);
Voronoi.AddEdge(edge.Item1, edge.Item2);
}
var newEdge = new HalfEdge() { Start = @event.vertex, StartVertex = index };