-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
make_convex_mesh.h
47 lines (40 loc) · 2.11 KB
/
make_convex_mesh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "drake/geometry/proximity/volume_mesh.h"
#include "drake/geometry/shape_specification.h"
namespace drake {
namespace geometry {
namespace internal {
/* Generates a tetrahedral volume mesh of the convex region enclosed by a
closed triangle surface mesh. The resulting mesh contains a vertex at the
centroid of the enclosed volume. Each tetrahedron is formed by connecting the
centroid to a surface triangle. Consideration is taken to orient the vertices
such that each tetrahedron has a positive signed volume.
For help visualizing this 3D operation we provide the following 2D analog:
v0─────────────────────v3 v0─────────────────────v3
│ │ │ \_ _/ │
│ │ │ \_ _/ │
│ │ │ \_ _/ │
│ │ │ \_ _/ │
│ │ │ \ / │
│ │ ───► │ _c_ │
│ │ │ _/ \_ │
│ │ │ _/ \_ │
│ │ │ _/ \_ │
│ │ │ _/ \_ │
│ │ │/ \│
v1─────────────────────v2 v1─────────────────────v2
@param[in] convex
The Convex shape specifiation describing the triangle surface mesh.
@pre We make the assumption that `surface_mesh` is sufficiently "nice".
That is:
- The closure of the interior of the mesh is a convex set.
- The mesh is closed and watertight.
- The surface normals of all faces are consistently outwardly oriented.
@retval volume_mesh
@tparam_nonsymbolic_scalar
*/
template <typename T>
VolumeMesh<T> MakeConvexVolumeMesh(const Convex& convex);
} // namespace internal
} // namespace geometry
} // namespace drake