Пример #1
0
        internal static TCell[] GetDelaunayTriangulation <TVertex, TCell>(IList <TVertex> data) where TVertex : IVertex where TCell : TriangulationCell <TVertex, TCell>, new()
        {
            ConvexHullAlgorithm convexHullAlgorithm = new ConvexHullAlgorithm(data.Cast <IVertex>().ToArray(), true, 1E-10);

            convexHullAlgorithm.GetConvexHull();
            convexHullAlgorithm.RemoveUpperFaces();
            return(convexHullAlgorithm.GetConvexFaces <TVertex, TCell>());
        }
        /// <summary>
        /// Computes the Delaunay triangulation.
        /// </summary>
        /// <typeparam name="TVertex">The type of the t vertex.</typeparam>
        /// <typeparam name="TCell">The type of the t cell.</typeparam>
        /// <param name="data">The data.</param>
        /// <returns>TCell[].</returns>
        internal static TCell[] GetDelaunayTriangulation <TVertex, TCell>(IList <TVertex> data)
            where TCell : TriangulationCell <TVertex, TCell>, new()
            where TVertex : IVertex
        {
            var ch = new ConvexHullAlgorithm(data.Cast <IVertex>().ToArray(), true, Constants.DefaultPlaneDistanceTolerance);

            ch.GetConvexHull();
            ch.RemoveUpperFaces();
            return(ch.GetConvexFaces <TVertex, TCell>());
        }