Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit d2047f2d authored by Michael KRISPER's avatar Michael KRISPER
Browse files

Delauney: added comments to the triangulate algorithm

parent e849cb30
No related branches found
No related tags found
No related merge requests found
......@@ -24,16 +24,23 @@ namespace TUGraz.VectoCore.Utils
var superTriangle = CalculateSuperTriangle();
// The "supertriangle" encompasses all triangulation points.
// This triangle initializes the algorithm and will be removed later.
var triangles = new List<Triangle> { superTriangle };
foreach (var point in _points)
{
// If the actual vertex lies inside a triangle, the edges of the triangle are
// added to the edge buffer and the triangle is removed from list.
var containerTriangles = triangles.FindAll(t => t.ContainsInCircumcircle(point));
triangles.RemoveAll(t => t.ContainsInCircumcircle(point));
var edges = containerTriangles.SelectMany(t => t.GetEdges());
var convexHullEdges = edges.
// Remove duplicate edges. This leaves the convex hull of the edges.
// The edges in this convex hull are oriented counterclockwise!
var convexHullEdges = containerTriangles.
SelectMany(t => t.GetEdges()).
GroupBy(edge => edge).
Where(group => group.Count() == 1).
SelectMany(group => group);
......@@ -46,10 +53,6 @@ namespace TUGraz.VectoCore.Utils
_triangles = triangles.FindAll(t => !t.SharesVertexWith(superTriangle));
}
/// <summary>
/// The "supertriangle" encompasses all triangulation points.
/// This triangle initializes the algorithm and will be removed later.
/// </summary>
private Triangle CalculateSuperTriangle()
{
const int superTriangleScalingFactor = 10;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment