使用 Burst 编译器为 Unity 进行 2D Delaunay 三角化并优化网格
A single-file package which provides Delaunay triangulation of the given set of points with constraints and mesh refinement.
Unity.Jobs pipeline ᵈᵒᶜˢfloat2, double2, Vector2, int2, and fixed-point Q31.32) ᵈᵒᶜˢTo view the documentation for the manual and scripting API access it online here or navigate to Documentation~/ and build this using docfx.json.
As an illustrative example, we present the triangulation of Lake Superior with various refinement parameters. The top-left image shows the result without any refinement.
The package utilizes the Burst compiler, which generates highly optimized native code using LLVM.
Below, you'll find a performance comparison for classic Delaunay triangulation (without refinement or constraints).
between this package and a few alternatives:
To see more benchmarks visit the documentation.
Install the package and add using in your code
using andywiecko.BurstTriangulator;and to triangulate unit box $[(0, 0), (1, 0), (1, 1), (0, 1)]$:
using var positions = new NativeArray(new[]
{
new(0, 0), new(1, 0), new(1, 1), new(0, 1)
}, Allocator.Persistent);
using var triangulator = new Triangulator(Allocator.Persistent)
{
Input = { Positions = positions }
};
triangulator.Run();
var triangles = triangulator.Output.Triangles;Required:
Optional:
Found a bug? Please open an issue. You can find a list of known issues here. Interested in contributing to the project? Feel free to open an issue or submit a pull request. For updates on current and future work related to this package, check out the package project.
暂无开放 Issues,或尚未同步最近议题。