Input validation
If ValidateInput
set to true, the provided InputData<T2>
and TriangulationSettings
will be validated before executing the triangulation procedure.
The input
InputData<T2>.Positions
,
InputData<T2>.ConstraintEdges
,
InputData<T2>.HoleSeeds
,
and InputData<T2>.IgnoreConstraintForPlantingSeeds
have certain restrictions:
- Positions count must be greater or equal 3.
- Positions and HoleSeeds cannot contain NaNs or infinities.
- Positions cannot be duplicated.
- ConstraintEdges should have length multiple of 2.
- ConstraintEdges should have constraints defined in Positions range.
- ConstraintEdges cannot be duplicated, swapped duplicated, or create self-loop.
- ConstraintEdges cannot intersect with each other.
- ConstraintEdges cannot be collinear with positions which is not included in the constraint.
- IgnoreConstraintForPlantingSeeds must have a length equal to half the length of ConstraintEdges.
If any of these conditions fail, triangulation will not be calculated. You can catch this as an error by using Status
(native reference, can be used in jobs).
For more details about error codes, refer to the Status API documentation.
using var triangulator = new Triangulator(Allocator.Persistent)
{
Input = { ... },
Settings = {
ValidateInput = true
},
};
triangulator.Run();
var status = triangulator.Output.Status.Value;
Warning
Input validation can be expensive. If you are certain of your input, consider disabling this option for additional performance.