Exemplo n.º 1
0
 /// <summary>
 /// Creates the Delaunay triangulation of the input data.
 /// </summary>
 /// <typeparam name="TVertex">The type of the t vertex.</typeparam>
 /// <typeparam name="TFace">The type of the t face.</typeparam>
 /// <param name="data">The data.</param>
 /// <param name="PlaneDistanceTolerance">The plane distance tolerance (default is 1e-10). If too high, points
 /// will be missed. If too low, the algorithm may break. Only adjust if you notice problems.</param>
 /// <returns>ITriangulation&lt;TVertex, TFace&gt;.</returns>
 public static ITriangulation <TVertex, TFace> CreateDelaunay <TVertex, TFace>(IList <TVertex> data,
                                                                               double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
     where TVertex : IVertex
     where TFace : TriangulationCell <TVertex, TFace>, new()
 {
     return(DelaunayTriangulation <TVertex, TFace> .Create(data, PlaneDistanceTolerance));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the Delaunay triangulation of the input data.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="PlaneDistanceTolerance">The plane distance tolerance (default is 1e-10). If too high, points
        /// will be missed. If too low, the algorithm may break. Only adjust if you notice problems.</param>
        /// <returns>ITriangulation&lt;DefaultVertex, DefaultTriangulationCell&lt;DefaultVertex&gt;&gt;.</returns>
        public static ITriangulation <DefaultVertex, DefaultTriangulationCell <DefaultVertex> > CreateDelaunay(
            IList <double[]> data,
            double PlaneDistanceTolerance = Constants.DefaultPlaneDistanceTolerance)
        {
            var points = data.Select(p => new DefaultVertex {
                Position = p
            }).ToList();

            return(DelaunayTriangulation <DefaultVertex, DefaultTriangulationCell <DefaultVertex> > .Create(points, PlaneDistanceTolerance));
        }