From 35d39cdb62bd476dc93a7fb8f58e6698db067af6 Mon Sep 17 00:00:00 2001 From: andywiecko Date: Thu, 17 Oct 2024 23:35:07 +0200 Subject: [PATCH] refactor: simplify unsafe triangulator vector2 extensions --- Runtime/Triangulator.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Runtime/Triangulator.cs b/Runtime/Triangulator.cs index adc9af9..f0c0cc8 100644 --- a/Runtime/Triangulator.cs +++ b/Runtime/Triangulator.cs @@ -826,7 +826,7 @@ public static class Extensions /// /// Note: /// This method requires that contains valid triangulation data. - /// The and native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. + /// The native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. /// /// The allocator to use. If called from a job, consider using . /// Expressed in radians. Default: 5° = 0.0872664626 rad. @@ -885,7 +885,7 @@ public static void DynamicInsertPoint(this UnsafeTriangulator @this, OutputData< /// /// Note: /// This method requires that contains valid triangulation data. - /// The and native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. + /// The native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. /// /// The allocator to use. If called from a job, consider using . /// Expressed in radians. Default: 5° = 0.0872664626 rad. @@ -924,7 +924,7 @@ public static void DynamicInsertPoint(this UnsafeTriangulator @this, Out /// The and native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. /// /// The allocator to use. If called from a job, consider using . - public static void Triangulate(this UnsafeTriangulator @this, InputData input, OutputData output, Args args, Allocator allocator) => new UnsafeTriangulator().Triangulate(UnsafeUtility.As, InputData>(ref input), UnsafeUtility.As, OutputData>(ref output), args, allocator); + public static void Triangulate(this UnsafeTriangulator @this, InputData input, OutputData output, Args args, Allocator allocator) => new UnsafeTriangulator().Triangulate(UnsafeUtility.As, InputData>(ref input), UnsafeUtility.As, OutputData>(ref output), args, allocator); /// /// Plants hole seeds defined in (or restores boundaries or auto-holes if specified in ) /// within the triangulation data in , using the settings specified in . @@ -935,7 +935,7 @@ public static void DynamicInsertPoint(this UnsafeTriangulator @this, Out /// The and native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. /// /// The allocator to use. If called from a job, consider using . - public static void PlantHoleSeeds(this UnsafeTriangulator @this, InputData input, OutputData output, Args args, Allocator allocator) => new UnsafeTriangulator().PlantHoleSeeds(UnsafeUtility.As, InputData>(ref input), UnsafeUtility.As, OutputData>(ref output), args, allocator); + public static void PlantHoleSeeds(this UnsafeTriangulator @this, InputData input, OutputData output, Args args, Allocator allocator) => new UnsafeTriangulator().PlantHoleSeeds(UnsafeUtility.As, InputData>(ref input), UnsafeUtility.As, OutputData>(ref output), args, allocator); /// /// Refines the mesh for a valid triangulation in . /// Refinement parameters can be provided with the selected precision type T in generics, which is especially useful for fixed-point arithmetic. @@ -944,12 +944,12 @@ public static void DynamicInsertPoint(this UnsafeTriangulator @this, Out /// /// Note: /// This method requires that contains valid triangulation data. - /// The and native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. + /// The native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. /// /// The allocator to use. If called from a job, consider using . /// Expressed in radians. Default: 5° = 0.0872664626 rad. /// Used to constrain boundary halfedges. Since the refinement algorithm (whether for constrained triangulation or not) requires constrained halfedges at the boundary, not setting this option may cause unexpected behavior, especially when the restoreBoundary option is disabled. - public static void RefineMesh(this UnsafeTriangulator @this, OutputData output, Allocator allocator, float areaThreshold = 1, float angleThreshold = 0.0872664626f, float concentricShells = 0.001f, bool constrainBoundary = false) => new UnsafeTriangulator().RefineMesh(UnsafeUtility.As, OutputData>(ref output), allocator, 2 * areaThreshold, angleThreshold, concentricShells, constrainBoundary); + public static void RefineMesh(this UnsafeTriangulator @this, OutputData output, Allocator allocator, float areaThreshold = 1, float angleThreshold = 0.0872664626f, float concentricShells = 0.001f, bool constrainBoundary = false) => new UnsafeTriangulator().RefineMesh(UnsafeUtility.As, OutputData>(ref output), allocator, 2 * areaThreshold, angleThreshold, concentricShells, constrainBoundary); /// /// Inserts a point into the given triangulation within the triangle at index , using the specified barycentric coordinates . /// For faster triangle lookup when inserting a point at specific coordinates, it is recommended to use an acceleration structure (e.g., bounding volume tree, buckets, etc.). @@ -998,7 +998,7 @@ public static void DynamicInsertPoint(this UnsafeTriangulator @this, Ou /// /// Note: /// This method requires that contains valid triangulation data. - /// The and native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. + /// The native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. /// /// The allocator to use. If called from a job, consider using . /// Expressed in radians. Default: 5° = 0.0872664626 rad. @@ -1080,7 +1080,7 @@ public static void DynamicInsertPoint(this UnsafeTriangulator @this, Ou /// /// Note: /// This method requires that contains valid triangulation data. - /// The and native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. + /// The native containers must be allocated by the user. Some buffers are optional; refer to the documentation for more details. /// /// The allocator to use. If called from a job, consider using . /// Expressed in radians. Default: 5° = 0.0872664626 rad.