Class Triangulator<T2>
A generic class for triangulation of coordinate type T2
, which provides the core functionality for performing triangulation on 2D geometric data.
Implements
Inherited Members
Namespace: andywiecko.BurstTriangulator
Assembly: .dll
Syntax
public class Triangulator<T2> : IDisposable where T2 : unmanaged
Type Parameters
Name | Description |
---|---|
T2 | The coordinate type. Supported types include: float2, Vector2, double2, Unity.Mathematics.FixedPoint.fp2, and int2. For more information on type restrictions, refer to the documentation. |
Remarks
The triangulation process can be configured using the parameters available in Settings. Provide the input data via Input, and then execute the triangulation using a proper extension Run(Triangulator<float2>) or Schedule(Triangulator<float2>, JobHandle). The triangulation results will be available in Output. Ensure you call Dispose() on the object after use to release resources. Example usage:
using var positions = new NativeArray<double2>(new[]
{
new (0, 0), new (1, 0), new (1, 1), new (0, 1)
}, Allocator.Persistent);
using var triangulator = new Triangulator<double2>(Allocator.Persistent)
{
Input = { Positions = positions },
Settings = { ValidateInput = false },
};
triangulator.Run();
var triangles = triangulator.Output.Triangles;
For advanced customization of the triangulation process, refer to UnsafeTriangulator<T2>.
Constructors
Name | Description |
---|---|
Triangulator(int, Allocator) | Initializes a new instance of the Triangulator<T2> class with the specified |
Triangulator(Allocator) | Initializes a new instance of the Triangulator<T2> class with the default capacity (16×1024) and memory |
Properties
Name | Description |
---|---|
Input | Input data used for triangulation. |
Output | Output data resulting from the triangulation process. |
Settings | Settings used for triangulation. |
Methods
Name | Description |
---|---|
Dispose() | Releases all resources (memory and safety handles). |