Skip to content

v3.3.0

Latest
Compare
Choose a tag to compare
@andywiecko andywiecko released this 23 Sep 15:25
· 12 commits to main since this release

✨ What's new?

🆕 Ignored constraints for seed planting

This feature is especially useful when the user wants to include a constraint but does not wish to enable any planting hole mechanism for that edge. Consider the following example input:

feat1

using var positions = new NativeArray<double2>(..., Allocator.Persistent);
using var constraintEdges = new NativeArray<int>(..., Allocator.Persistent);
using var ignoreConstraint = new NativeArray<bool>(..., Allocator.Persistent);
using var triangulator = new Triangulator(Allocator.Persistent)
{
  Input = {
    Positions = positions,
    ConstraintEdges = constraintEdges,
    IgnoreConstraintForPlantingSeeds = ignoreConstraint,
  },
  Settings = { AutoHolesAndBoundary = true, },
};

triangulator.Run();

var triangles = triangulator.Output.Triangles;

In this example, the red constraint is set to true in IgnoreConstraintForPlantingSeeds. As a result, a hole is not generated from red constraint, and the edge remains part of the final triangulation.

📈 Faster hole planting

The complexity has improved from $\mathcal O(n^2)$ to $\mathcal O(n)$, making hole planting almost free compared to the Delaunay step.
Below is a benchmark for Constrained Delaunay triangulation with the auto-holes option enabled. As a test case, we use a square containing hole squares (denoted by #holes). Reference timings for the auto-holes option disabled are marked with a dashed line.

image

Co-authored-by: @HalfVoxel

🔧Fix overflow for int2

Overflow for int2 coordinates for large coordinates with differences around $\sim 2^{20}$ was resolved.
Example input which failed to triangulate correctly before this release can be seen below:

image

Co-authored-by: @HalfVoxel

🆕 Status error codes

New flags have been added to the Status enum for enhanced error handling during triangulation. Users can now catch errors during validation more effectively. Note: The Status enum is now decorated with the [Flags]. To check if no errors occurred, use

if (status != Status.OK)
{
    return;
}

Read more at project's documentation.

📝 Changelog

Added

  • Ignored constraints for seed planting. Users can now ignore specific constraints during the seed planting process. This is especially useful when constraining edges without creating hole boundaries. This option can be set using Input.IgnoreConstraintForPlantingSeeds. Additionally, post-triangulation verification can be done with Output.IgnoredHalfedgesForPlantingSeeds, which provides a list of booleans indicating whether a given halfedge was ignored during seed planting.
  • Status error codes. New flags have been added to the Status enum for enhanced error handling during triangulation. Users can now catch errors during validation more effectively. Note: The Status enum is now decorated with the [Flags]. To check if no errors occurred, use status == Status.OK.

Changed

  • Faster hole planting. The complexity has improved from 𝒪(n²) to 𝒪(n), making hole planting almost free compared to the Delaunay step.
  • Improved validation. All input data buffers are now validated. Additionally, some unconfigured settings can trigger log warnings.

Fixed

  • Integer overflow for int2 coordinates. Resolved an overflow issue for large coordinates with differences around ~2²⁰.

Full Changelog: v3.2.1...v3.3.0