Skip to content

Commit 4fbda9f

Browse files
committed
added an explanation why we sometimes need to reduce the triangle sizes of a mesh and a short tutorial how to do this using MeshLab.
1 parent fb6ed01 commit 4fbda9f

10 files changed

+44
-0
lines changed

docs/media/shrink_faces_01_orig.png

120 KB
Loading
266 KB
Loading

docs/media/shrink_faces_03_edit.png

273 KB
Loading

docs/media/shrink_faces_04_05.png

395 KB
Loading
375 KB
Loading

docs/media/shrink_faces_05_03.png

410 KB
Loading
468 KB
Loading
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Explanation: Vertex Density and MeshNav
2+
3+
![ShrinkFaces01](/media/shrink_faces_01_orig.png)
4+
5+
This is the mesh of the `floor_is_lava` world used for simulation in the [MeshNav tutorials](https://github.com/naturerobots/mesh_navigation_tutorials), visualized with [MeshLab](https://www.meshlab.net/).
6+
7+
You may notice that the triangles are very large. As shown in MeshLab's statistics, the entire, rather complex environment is represented by **just** 86 faces (connecting 52 vertices).
8+
9+
For many operations, this is desirable, as it greatly reduces the amount of data needed to represent a large environment:
10+
11+
- **Rendering**: fewer triangles need to be projected onto the camera plane,
12+
13+
- **Collisions**: fewer potential contact faces need to be evaluated for physics simulation.
14+
15+
However, some algorithms require a certain triangle density to function properly. For example, the simulation of bending materials or (most importantly for you) MeshNav's current planner implementations. MeshNav's cost layer system computes costs per vertex. For example, it may compute the maximum height difference in the immediate vicinity of a vertex:
16+
17+
![ShrinkFaces02](/media/shrink_faces_02_orig_rviz.png)
18+
19+
In this visualization, you can see that each edge is assigned a cost inferred from the two vertices it connects. In this case, the edge receives a "bad" value because both vertices are in a dangerous region. Other problems that arise when using such low-resolution meshes for planning include:
20+
- Graph search algorithms may be forced to choose dangerous paths.
21+
- Cost inflation effects cannot be represented with sufficient resolution.
22+
23+
One solution is to prepare the map with faces that are small enough. Fortunately, once we have a mesh, this operation is relatively straightforward:
24+
25+
!!! note
26+
27+
This operation will increase the number of faces. It will likely also increase the computational requirements for some navigation operations performed on the mesh.
28+
29+
# Shrink Faces via MeshLab
30+
31+
Open the mesh in MeshLab. Then go to `Filters -> Remeshing, Simplification, and Reconstruction` and select `Remeshing: Isotropic Explicit Remeshing`.
32+
33+
![Edit1](/media/shrink_faces_03_edit.png)
34+
35+
Set the "Target Length" and "Max. Surface Distance" absolute values.
36+
37+
| 0.5 | 0.3 |
38+
|:--:|:--:|
39+
| MeshLab ![Edit2](/media/shrink_faces_04_05.png) | MeshLab ![Edit3](/media/shrink_faces_05_03.png) |
40+
| MeshNav ![Edit2b](/media/shrink_faces_04_05_rviz.png) | MeshNav ![Edit3b](/media/shrink_faces_05_03_rviz.png) |
41+
42+
In the bottom row, you can see MeshNav’s inflation cost layer visualized in RViz. The higher the resolution of the triangles, the better we can represent the lethal area within the inscribed inflation radius of 0.4 m.

docs/tutorials/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Mesh Editing:
2424

2525
- [Flatten Floor](/tutorials/editing/flatten_surface.md)
2626
- [Align Mesh to Ground](/tutorials/editing/align_mesh_to_ground.md)
27+
- [Shrink Faces](/tutorials/editing/shrink_faces.md)
2728

2829

2930

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ nav:
5454
- Mesh Editing:
5555
- Flatten Surfaces: tutorials/editing/flatten_surface.md
5656
- Align Mesh to Ground: tutorials/editing/align_mesh_to_ground.md
57+
- Shrink Faces: tutorials/editing/shrink_faces.md
5758
- Writing Plugins:
5859
- Own Cost Layer: tutorials/plugins/own_cost_layer.md
5960
- Library:

0 commit comments

Comments
 (0)