You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation~/manual/advanced/dynamic-triangulation.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,14 @@ This feature is especially useful in scenarios like path-finding in RTS games, w
9
9
10
10
## DynamicInsertPoint
11
11
12
-
The [DynamicInsertPoint][dynamic-insert-point] method allows you to insert a point into a specified triangle using barycentric coordinates. This method only supports point insertion within the original triangulation domain and cannot be used to insert points outside the existing mesh.
12
+
The [`DynamicInsertPoint`][dynamic-insert-point] method allows you to insert a point into a specified triangle using barycentric coordinates. This method only supports point insertion within the original triangulation domain and cannot be used to insert points outside the existing mesh.
13
13
14
14
Inserting a point at specific `T2 p` coordinates can be computationally expensive since it requires locating the triangle that contains the point `p`.
15
15
This package does not include acceleration structures, as it assumes the user will implement this based on their specific requirements.
16
16
It is recommended to use structures such as bounding volume hierarchies, 2D trees, grids, or buckets for efficient point lookup (`p` $\to \triangle$).
17
17
The most suitable acceleration structure may vary depending on the use case.
18
18
19
-
The [DynamicInsertPoint][dynamic-insert-point] method accepts the following parameters (in addition to `output` and `allocator`):
19
+
The [`DynamicInsertPoint`][dynamic-insert-point] method accepts the following parameters (in addition to `output` and `allocator`):
20
20
21
21
-`tId` the index of the triangle where the point should be inserted.
22
22
-`bar` the barycentric coordinates of the point inside triangle `tId`.
The [DynamicSplitHalfedge][dynamic-split-halfedge] methodallowsyoutosplitspecifiedhalfedgebyinsertingapointatapositiondeterminedbylinearinterpolation.
78
+
The [`DynamicSplitHalfedge`][dynamic-split-halfedge] methodallowsyoutosplitspecifiedhalfedgebyinsertingapointatapositiondeterminedbylinearinterpolation.
The [DynamicSplitHalfedge][dynamic-split-halfedge] methodacceptsthefollowingparameters (inadditionto `output` and `allocator`):
82
+
The [`DynamicSplitHalfedge`][dynamic-split-halfedge] methodacceptsthefollowingparameters (inadditionto `output` and `allocator`):
83
83
84
84
- `he` theindexofthehalfedgetosplit.
85
85
- `alpha` theinterpolationparameterfor positioning the new point between the start and end points of the halfedge, where $p = (1 - \alpha) \, \text{start} + \alpha \, \text{end}$.
@@ -121,10 +121,10 @@ for(int i = 0; i < 32; i++)
121
121
122
122
## DynamicRemoveBulkPoint
123
123
124
-
The [DynamicRemoveBulkPoint][dynamic-remove-point] method allows you to remove bulk points, i.e. points which are not boundary ones, and re-triangulates the affected region to maintain a valid triangulation.
124
+
The [`DynamicRemoveBulkPoint`][dynamic-remove-point] method allows you to remove bulk points, i.e. points which are not boundary ones, and re-triangulates the affected region to maintain a valid triangulation.
125
125
In addition to `output` and `allocator`, the method requires the index of the point to be removed, specified as `pId`.
126
126
127
-
Below is an example demonstrating how to use the [DynamicRemoveBulkPoint][dynamic-remove-point] API:
127
+
Below is an example demonstrating how to use the [`DynamicRemoveBulkPoint`][dynamic-remove-point] API:
Copy file name to clipboardExpand all lines: Documentation~/manual/advanced/unsafe-triangulator.md
+31-12Lines changed: 31 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,7 @@ Below, you can find extensions (with descriptions and examples) that can be used
83
83
84
84
### Triangulate
85
85
86
-
The extension [`Triangulate(input, output, args, allocator)`][triangulate] is the simplest option to use. The action of this extension essentially produces the same result as the [`Run`][run] method for the managed [`Triangulator`][triangulator]. It can be useful when triangulation is done with [`Allocator.Temp`][allocator-temp] in a single job or to combine this with different extensions.
86
+
The extension [`Triangulate`][triangulate] is the simplest option to use. The action of this extension essentially produces the same result as the [`Run`][run] method for the managed [`Triangulator`][triangulator]. It can be useful when triangulation is done with [`Allocator.Temp`][allocator-temp] in a single job or to combine this with different extensions.
The extension [`PlantHoleSeeds(input, output, args, allocator)`][plant-seeds] is particularly useful when the user requires mesh data *without* removed triangles and additional mesh copy *with* removed triangles. In this case, the triangulation is performed once, which is generally a more expensive operation. Below is an example usage with the `autoHolesAndBoundary` option selected:
140
+
The extension [`PlantHoleSeeds`][plant-seeds] is particularly useful when the user requires mesh data *without* removed triangles and additional mesh copy *with* removed triangles. In this case, the triangulation is performed once, which is generally a more expensive operation. Below is an example usage with the `autoHolesAndBoundary` option selected:
143
141
144
142
```csharp
145
143
varinput=newNativeInputData<double2>
@@ -156,18 +154,39 @@ var output = new NativeOutputData<double2>
> Depending on the options, some of the buffers may not be required for [`PlantHoleSeeds`][plant-seeds]. For example, when the user provides `HoleSeeds` in [`NativeInputData<T2>`][n-output-data], `Positions` in [`NativeOutputData<T2>`][n-output-data] must be provided. However, in other cases, it may not be required.
167
164
165
+
The extension provides also an option to generate a `mapping` from the initial triangles (`t1`) to the triangles after planting seeds (`t2`).
166
+
The condition `t1[3*i + k] == t2[mapping[3*i + k]]` (for $k\in\{0, 1, 2\}$) should hold for triangles that still exist in `t2`.
167
+
If `mapping[i] == -1`, then the corresponding triangle `i` no longer exists in `t2`.
// - `triangles1`: the initial triangles buffer before planting seeds.
183
+
// - `triangles2`: the triangles after planting seeds.
184
+
// - `mapping`: `triangles1` → `triangles2`.
185
+
```
186
+
168
187
### RefineMesh
169
188
170
-
The extension [`RefineMesh(output, allocator, areaThreshold?, angleThreshold?, concentricShells?, constrainBoundary?)`][refine-mesh] can be used to refine any triangulation mesh, even an already refined one. Please note that both the managed [`TriangulationSettings`][m-settings] and native [`Args`][n-args] provide refinement parameter setups only for [`float`][float] precision. This extension allows you to provide these parameters with the selected precision type `T` in generics. These parameters have the following default values (in the given precision type `T`, if this extension is available for `T`):
189
+
The extension [`RefineMesh`][refine-mesh] can be used to refine any triangulation mesh, even an already refined one. Please note that both the managed [`TriangulationSettings`][m-settings] and native [`Args`][n-args] provide refinement parameter setups only for [`float`][float] precision. This extension allows you to provide these parameters with the selected precision type `T` in generics. These parameters have the following default values (in the given precision type `T`, if this extension is available for `T`):
Copy file name to clipboardExpand all lines: Documentation~/manual/utilities.md
+31-8Lines changed: 31 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,31 @@ uid: utilities-md
6
6
7
7
The package also provides several utilities related to triangulations.
8
8
These utilities can be found in the [Utilities] and [Extensions] classes.
9
+
Most of the utilities are *Burst-compatible* and are implemented using spans, so they can be used with any collection type.
10
+
11
+
## BoundingBox
12
+
13
+
The method [`BoundingBox`][bounding-box] returns *axis-aligned bounding box* for provided collection of points.
14
+
It supports all position types (`float2`/`int2`/`double2`/`fp2`), see example below:
15
+
16
+
```csharp
17
+
varpositions=newfloat2[]{ ... };
18
+
var (min, max) =Utilities.BoundingBox(positions);
19
+
```
20
+
21
+
## CenterOfMass
22
+
23
+
The method [`CenterOfMass`][center-of-mass] returns *center of mass* (COM) for provided collection of points, assuming equal weights for all positions.
24
+
It supports all position types (`float2`/`int2`/`double2`/`fp2`), see example below:
25
+
26
+
```csharp
27
+
varpositions=newfloat2[]{ ... };
28
+
varcom=Utilities.CenterOfMass(positions);
29
+
```
9
30
10
31
## GenerateHalfedges
11
32
12
-
The method [GenerateHalfedges(Span<int> halfedges, ReadOnlySpan<int> triangles, Allocator allocator)][generate-halfedges] can be used to generate halfedges based on the given triangles. The provided `allocator` is used for temporary data allocation.
33
+
The method [`GenerateHalfedges`][generate-halfedges] can be used to generate halfedges based on the given triangles. The provided `allocator` is used for temporary data allocation.
13
34
This function is especially useful when you have mesh data but need to use halfedges, for example, when iterating through the mesh.
14
35
Learn more about halfedges [here](advanced/output-halfedges.md).
The method [GeneratePointTriangleCount][generate-point-triangle-count] populates the `pointTriangleCount` buffer with the number of triangles each vertex index is part of, based on the provided triangles index buffer.
49
+
The method [`GeneratePointTriangleCount`][generate-point-triangle-count] populates the `pointTriangleCount` buffer with the number of triangles each vertex index is part of, based on the provided triangles index buffer.
29
50
The provided `pointTriangleCount` buffer for counting triangles must be large enough to accommodate the highest index in `triangles`.
0 commit comments