public void Test1()
 {
     IGeometry geom = _wktReader.Read("POLYGON ((0 0, 0 10, 4 10, 4 8, 6 8, 6 10, 10 10, 10 0, 0 0))");
     DelaunayTriangulationBuilder dtb = new DelaunayTriangulationBuilder();
     dtb.SetSites(geom);
     IMultiLineString resultEdges = dtb.GetEdges(geom.Factory);
     Console.WriteLine(resultEdges.AsText());
     IGeometryCollection resultTriangles = dtb.GetTriangles(geom.Factory);
     Console.WriteLine(resultTriangles.AsText());
 }
Exemplo n.º 2
0
        private static void RunDelaunay(string sitesWKT, bool computeTriangles, string expectedWKT)
        {
            WKTReader reader = new WKTReader();
            IGeometry sites = reader.Read(sitesWKT);

            DelaunayTriangulationBuilder builder = new DelaunayTriangulationBuilder();
            builder.SetSites(sites);

            IGeometryFactory geomFact = GeometryFactory.Default;
            IGeometry result = computeTriangles ? builder.GetTriangles(geomFact) : builder.GetEdges(geomFact);
            Assert.IsNotNull(result);

            IGeometry expected = reader.Read(expectedWKT);
            result.Normalize();
            expected.Normalize();
            Assert.IsTrue(expected.EqualsExact(result, ComparisonTolerance));
        }
 public static IGeometry DelaunayTriangles(IGeometry geom)
 {
     DelaunayTriangulationBuilder builder = new DelaunayTriangulationBuilder();
     builder.SetSites(geom);
     builder.Tolerance = TriangulationTolerance;
     IGeometryCollection tris = builder.GetTriangles(geom.Factory);
     return tris;
 }
 public static IGeometry delaunayTriangles(IGeometry geom)
 {
     var builder = new DelaunayTriangulationBuilder();
     builder.SetSites(geom);
     builder.Tolerance = TRIANGULATION_TOLERANCE;
     var tris = builder.GetTriangles(geom.Factory);
     return tris;
 }