Skip to content

v3.1.0

Compare
Choose a tag to compare
@andywiecko andywiecko released this 03 Aug 09:17
· 119 commits to main since this release

✨ What's new?

Managed input

You can now use managed arrays as triangulator input (i.e., standard C# arrays T2[]). Simply use new ManagedInput {} as the input object.

using var triangulator = new Triangulator<float2>(Allocator.Persistent)
{
    Input = new ManagedInput<float2>
    {
        Positions = new float2[] { new(0, 0), new(1, 0), new(1, 1), new(0, 1) }
    },
};

Alternatively, you can use the AsNativeArray extension to create a NativeArray<T> view for the managed array in place.

float2[] positions = { new(0, 0), new(1, 0), new(1, 1), new(0, 1) };
using var triangulator = new Triangulator<float2>(Allocator.Persistent)
{
    Input = { Positions = positions.AsNativeArray() },
};

Constrained Halfedges

When performing constrained triangulation, you can determine whether a given halfedge is constrained by using Output.ConstrainedHalfedges.

var constrainedHalfedges = triangulator.Output.ConstrainedHalfedges;

This information can be particularly useful during post-processing by the user.

Native support

Native support for triangulation is now available. You can call triangulation routines in jobs via UnsafeTriangulator<T>.
Below one can find minimal working example using UnsafeTriangulator<T2>

using andywiecko.BurstTriangulator.LowLevel.Unsafe;

...

using var positions = new NativeArray<float2>(..., Allocator.Temp);
using var triangles = new NativeArray<int>(64, Allocator.Temp);
new UnsafeTriangulator<float2>().Triangulate(
    input: new() { Positions = positions },
    output: new() { Triangles = triangles },
    args: Args.Default(),
    allocator: Allocator.Persistent
);

This corresponds to the following managed approach with Triangulator<T2>

using var triangulator = new Triangulator(Allocator.Persistent)
{
    Input = { Positions = new float2[]{ ... }.AsNativeArray() }
};
triangulator.Run();
var triangles = triangulator.Output.Triangles;

To learn more about customization, read the documentation.

🔔 Announcements

🚀 Next Release Roadmap

In the next release, we plan to add a few very exciting features, including support for:

  • Vector2 input
  • int2 input
  • fp2 input (fixed-point type in Q31.32 format)
  • dynamic triangulation by point insertion

📦 New Extension Package!

We have started working on a new package based on BurstTriangulator! This package will be an extension of BurstTriangulator and will include utilities related to pathfinding. It aims to provide a highly efficient solution for triangle meshes!

❤ Sponsoring

GitHub Sponsoring is now available! If you're using the package and are interested in supporting our work, please consider becoming a sponsor!

📝 Change log

Added

  • Native support with a low-level API for triangulation via UnsafeTriangulator<T>. This allows for customization of steps and calling triangulation directly from jobs.
  • Extensions for UnsafeTriangulator<T>: Triangulate, PlantHoleSeeds, and RefineMesh.
  • Support for managed input.
  • Public ConstrainedHalfedges in triangulation output.

Fixed

  • Edge-edge intersection for collinear non-intersecting edges (issue [#173]).

Full Changelog: v3.0.0...v3.1.0