Skip to content

v3.6.0

Latest
Compare
Choose a tag to compare
@andywiecko andywiecko released this 01 Feb 10:25

✨ What's new?

Welcome to 2025! After the first month of the year, a new release of BurstTriangulator has arrived! This update finally supplements dynamic triangulation with the constrain edges method. Refinement performance has improved, and several small fixes have been made.

📈 Enhanced refinement performance

By replacing NativeQueue with NativeQueueList, I've managed to increase refinement performance by up to 50% (depending on the input). See the benchmarks attached below for details. Read the manual for test case specification.

image

image

🆕 ConstrainEdge

The ConstrainEdge extension allows you to constrain the edge (pi, pj). This is particularly useful for dynamic triangulation, enabling users to insert a path dynamically while constraining its edges.

Warning

This method is restricted to bulk mesh, meaning the constrained edge must not intersect any holes.

Additionally, the optional parameter ignoreForPlantingSeeds ignores the halfedges corresponding to (pi, pj) from during the seed planting step.

Here's an example demonstrating how to use the ConstrainEdge extension:

using var inputPositions = new NativeArray<double2>(..., Allocator.Persistent);
var output = new NativeOutputData<double2>
{
    Positions = inputPositions,
};

using var status = new NativeReference<Status>(Status.OK, Allocator.Persistent);
using var outputPositions = new NativeList<double2>(Allocator.Persistent);
using var triangles = new NativeList<int>(Allocator.Persistent);
using var halfedges = new NativeList<int>(Allocator.Persistent);
using var constrainedHalfedges = new NativeList<bool>(Allocator.Persistent);
using var ignoredHalfedgesForPlantingSeeds = new NativeList<bool>(Allocator.Persistent);
var output = new NativeOutputData<double2>
{
    Status = status,
    Positions = outputPositions,
    Triangles = triangles,
    Halfedges = halfedges,
    ConstrainedHalfedges = constrainedHalfedges,
    IgnoredHalfedgesForPlantingSeeds = ignoredHalfedgesForPlantingSeeds,
};

var args = Args.Default();

var t = new UnsafeTriangulator<double2>();
t.Triangulate(input, output, args, Allocator.Persistent);
t.ConstrainEdge(output, pi: 0, pj: 1, args, allocator: Allocator.Persistent, ignoreForPlantingSeeds: true);

📝 Changelog

Added

  • ConstrainEdge extension for UnsafeTriangulator<T>. Edges can now be constrained dynamically.
  • NativeInputData<T> and NativeOutputData<T>, which are essentially LowLevel.Unsafe.InputData<T> and LowLevel.Unsafe.OutputData<T>. This change resolves ambiguity between managed and unmanaged input/output data.
  • (Internal) NativeQueueList<T>, an alternative implementation to Unity.Collections.NativeQueue<T>. This wrapper is more stable and faster, though it consumes more memory.

Changed

  • Improved the performance of the refinement step. Depending on the input, speedups of up to 50% can be observed!
  • Various documentation (summary/manual/scripting API) tweaks.

Deprecated

  • LowLevel.Unsafe.InputData<T> and LowLevel.Unsafe.OutputData<T> have been deprecated. Use NativeInputData<T> and NativeOutputData<T> instead.

Fixed

  • A rare issue causing an editor crash when reloading the domain, apparently caused by NativeQueue. This has been resolved by replacing NativeQueue with the internal NativeQueueList<T> implementation.

Full Changelog: v3.5.0...v3.6.0