namespace MIConvexHull
{
using System.Collections.Generic;
using System.Linq;
///
/// Simple interface to unify different types of triangulations in the future.
///
///
///
public interface ITriangulation
where TCell : TriangulationCell, new()
where TVertex : IVertex
{
IEnumerable Cells { get; }
}
///
/// Factory class for creating triangulations.
///
public static class Triangulation
{
///
/// Creates the Delaunay triangulation of the input data.
///
///
///
///
public static ITriangulation> CreateDelaunay(IEnumerable data)
where TVertex : IVertex
{
return DelaunayTriangulation>.Create(data);
}
///
/// Creates the Delaunay triangulation of the input data.
///
///
///
public static ITriangulation> CreateDelaunay(IEnumerable data)
{
var points = data.Select(p => new DefaultVertex { Position = p.ToArray() });
return DelaunayTriangulation>.Create(points);
}
///
/// Creates the Delaunay triangulation of the input data.
///
///
///
///
///
public static ITriangulation CreateDelaunay(IEnumerable data)
where TVertex : IVertex
where TFace : TriangulationCell, new()
{
return DelaunayTriangulation.Create(data);
}
}
}