无法在 NetTopologySuite 中获得点的闭合三角剖分
Cannot get a closed triangulation of points in NetTopologySuite
我正在使用 NetTopologySuite version 1.14 and playing with it in order to calculate the Triangulation 一组点。更具体地说:
I want a 3D Delaunay triangulation of a set of points in the 3D space which is also closed (the final mesh must be closed: an hull).
我的尝试
根据我链接的 API,我编写了这个简单的程序:
var builder = new NTS.Triangulate.ConformingDelaunayTriangulationBuilder();
builder.SetSites(new NTS.Geometries.MultiPoint(new[] { // A (square) pyramid
new NTS.Geometries.Point(0, 0, 0),
new NTS.Geometries.Point(2, 0, 0),
new NTS.Geometries.Point(0, 2, 0),
new NTS.Geometries.Point(2, 2, 0),
new NTS.Geometries.Point(1, 1, 2)
}));
var triangles = builder.GetTriangles(new NTS.Geometries.GeometryFactory());
Console.WriteLine("Triangles: " + triangles.ToString());
哪个returns:
(0 2 0, 0 0 0, 1 1 2, 0 2 0),
(0 2 0, 1 1 2, 2 2 0, 0 2 0),
(2 2 0, 1 1 2, 2 0 0, 2 2 0),
(0 0 0, 2 0 0, 1 1 2, 0 0 0)
开网
这是正确的,但它只生成了 4 个面(三角形)。我期待 6 个三角形(金字塔的底部应该通过添加 2 个三角形来包含在内)。我基本上得到一个开放的网格。我期待这 2 个额外的三角形:
(0 0 0, 2 0 0, 0 2 0, 0 0 0),
(0 2 0, 2 0 0, 2 2 0, 0 2 0)
如何在生成三角剖分时获得闭合网格?
已在 GitHub 的 NTS 官方报告中回答 here。
我正在使用 NetTopologySuite version 1.14 and playing with it in order to calculate the Triangulation 一组点。更具体地说:
I want a 3D Delaunay triangulation of a set of points in the 3D space which is also closed (the final mesh must be closed: an hull).
我的尝试
根据我链接的 API,我编写了这个简单的程序:
var builder = new NTS.Triangulate.ConformingDelaunayTriangulationBuilder();
builder.SetSites(new NTS.Geometries.MultiPoint(new[] { // A (square) pyramid
new NTS.Geometries.Point(0, 0, 0),
new NTS.Geometries.Point(2, 0, 0),
new NTS.Geometries.Point(0, 2, 0),
new NTS.Geometries.Point(2, 2, 0),
new NTS.Geometries.Point(1, 1, 2)
}));
var triangles = builder.GetTriangles(new NTS.Geometries.GeometryFactory());
Console.WriteLine("Triangles: " + triangles.ToString());
哪个returns:
(0 2 0, 0 0 0, 1 1 2, 0 2 0),
(0 2 0, 1 1 2, 2 2 0, 0 2 0),
(2 2 0, 1 1 2, 2 0 0, 2 2 0),
(0 0 0, 2 0 0, 1 1 2, 0 0 0)
开网
这是正确的,但它只生成了 4 个面(三角形)。我期待 6 个三角形(金字塔的底部应该通过添加 2 个三角形来包含在内)。我基本上得到一个开放的网格。我期待这 2 个额外的三角形:
(0 0 0, 2 0 0, 0 2 0, 0 0 0),
(0 2 0, 2 0 0, 2 2 0, 0 2 0)
如何在生成三角剖分时获得闭合网格?
已在 GitHub 的 NTS 官方报告中回答 here。