Generic coordinates
The package supports generic coordinates.
Currently, support is provided for float2
, double2
, Vector2
, fp2
and int2
.
By default, the Triangulator
class is based on the double2
type. To manually select the desired coordinate type, use the generic version, namely, Triangulator<T2>
.
using var positions = new NativeArray<float2>(..., Allocator.Persistent);
using var triangulator = new Triangulator<float2>(Allocator.Persistent)
{
Input = { Positions = positions },
};
triangulator.Run();
Triangulator<T2>
has the same API (through Extensions), as Triangulator
.
The only difference is that the input/output types are the same as T2
.
See benchmark for the generic coordinates here.
type |
delaunay | constraints | holes | refinement | preprocessors | dynamic1 |
notes |
---|---|---|---|---|---|---|---|
float2 |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
Vector2 |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | Via float2 reinterpret |
double2 |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
fp2 |
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | Requires additional package2 |
int2 |
✔️ | ✔️ | 🟡3 | ❌ | 🟡4 | ❌ | Support up to \(\sim 2^{20}\) |
-
Available only through
UnsafeTriangulator<T>
API.↩ -
This feature is available through an optional dependency. Users must install
com.danielmansson.mathematics.fixedpoint
. See how to install it here.↩ -
In the current implementation, holes are fully supported with
Settings.AutoHolesAndBoundary
. However, manual holes withint2
coordinates may not guarantee that the given hole can be created. An additional extension is planned in the future to support holes with manual floating-point precision forint2
.↩ -
Support for
Preprocessor.COM
with translation only is available.↩