#include <Mesh.h>
Provides functionality for mesh post-processing and export.
More...
Provides functionality for mesh post-processing and export.
|
| Mesh () |
| Construct empty mesh.
|
|
| ~Mesh () |
| Destructor.
|
|
int | vertexCount () const |
| Return number of vertices in the mesh. More...
|
|
int | triangleCount () const |
| Return number of triangles in the mesh. More...
|
|
Coordinate | vertex (int idx) const |
| Returns the specified vertex. More...
|
|
bool | setVertex (int idx, const Coordinate &vertex) |
| Set vertex coordinates. More...
|
|
Coordinate | normal (int idx) const |
| Returns the specified vertex normal at vertex idx. More...
|
|
bool | setNormal (int idx, const Coordinate &normal) |
| Set vertex normal. More...
|
|
Color | color (int idx) const |
| Returns the vertex color at vertex idx. More...
|
|
bool | setColor (int idx, const Color &color) |
| Set vertex color. More...
|
|
Triangle | triangle (int idx) const |
| Returns the specified triangle vertex indices. More...
|
|
int | addTriangle (const Triangle &triangle) |
| Add triangle consisting of the given vertex indices. More...
|
|
Vec3 | center () const |
| Get mesh bounding box center. More...
|
|
Vec3 | extent () const |
| Get mesh bounding box extent. More...
|
|
bool | save (const char *filename, MeshFormat format) |
| Save mesh to file. More...
|
|
void | transform (const Mat3 &R, const Vec3 &t) |
| Transform mesh with the given rotation and translation. More...
|
|
bool | decimate (int minEdgeLength, int maxEdgeLength, bool preserveColors) |
| Decimate mesh. More...
|
|
bool | smooth (int iterations) |
| Smooth mesh. More...
|
|
bool | clean (double minComponentArea, double maxComponentArea) |
| Clean mesh by removing connected components with certain surface area. More...
|
|
bool | crop (const Vec3 &boxCenter, const Vec3 &boxExtent, const bool discardPointsInside=false) |
| Crop mesh with given bounding box. More...
|
|
bool | fillHoles (int level=-1) |
| Fill holes in mesh to make it manifold. More...
|
|
bool | makeHollow (double wall) |
| Make mesh hollow. More...
|
|
bool | removeBoundaryFaces (int layers) |
| Remove boundary faces from the mesh. More...
|
|
bool | isManifold () const |
| Checks mesh manifoldness, i.e. More...
|
|
bool | applyTexture () |
| Apply texture mapping to the mesh. More...
|
|
|
static Mesh * | create (int vertexCount, const double *vertices, int triangleCount, const int *triangleIndices, const double *colors=0, const double *normals=0, int volRes=512) |
| Creates mesh from user data. More...
|
|
◆ MeshFormat
Supported mesh export formats.
Enumerator |
---|
PLY | Binary PLY format.
|
OBJ | OBJ format.
|
STL | STL format (does not include color)
|
◆ create()
static Mesh* create |
( |
int |
vertexCount, |
|
|
const double * |
vertices, |
|
|
int |
triangleCount, |
|
|
const int * |
triangleIndices, |
|
|
const double * |
colors = 0 , |
|
|
const double * |
normals = 0 , |
|
|
int |
volRes = 512 |
|
) |
| |
|
static |
Creates mesh from user data.
- Parameters
-
vertexCount | Number of vertices in vertices array. |
vertices | Pointer to array of vertex coordinates with x, y and z-coordinates. Array must have size 3*vertexCount. |
triangleCount | Number of triangles in triangleIndices array. |
triangles | Pointer to array of triangle vertex indeces. A triangle is described by the three zero-based indices of its vertices. Array must have size 3*triangleCount. |
colors | Pointer to array of vertex colors with RGB color values in the range [0;1]. Array must have size 3*vertexCount. If not specified mesh will not contain color. |
colors | Pointer to array of vertex normals with x, y and z-coordinates. The normal vectors should be normalized. Array must have size 3*vertexCount. If not specified normals are computed automatically. |
volRes | Volume resolution used during reconstruction |
- Returns
- Pointer to newly created mesh. User needs to delete mesh after usage. Returns null pointer if an error occurs (inconsistent mesh, no license)
◆ vertexCount()
int vertexCount |
( |
| ) |
const |
Return number of vertices in the mesh.
- Returns
- Number of mesh vertices.
◆ triangleCount()
int triangleCount |
( |
| ) |
const |
Return number of triangles in the mesh.
- Returns
- Number of mesh triangles.
◆ vertex()
Returns the specified vertex.
- Parameters
-
- Returns
- Coordinate of vertex.
If idx is bigger than the vertex count (0,0,0) is returned.
◆ setVertex()
bool setVertex |
( |
int |
idx, |
|
|
const Coordinate & |
vertex |
|
) |
| |
Set vertex coordinates.
- Parameters
-
idx | The index of the vertex. |
vertex | Vertex coordinates. |
- Returns
- If the index does not exist in the mesh false is returned
◆ normal()
Returns the specified vertex normal at vertex idx.
- Parameters
-
- Returns
- Normal of vertex.
If idx is bigger than the vertex count or there is no normal associated with the vertex (0,0,0) is returned.
◆ setNormal()
bool setNormal |
( |
int |
idx, |
|
|
const Coordinate & |
normal |
|
) |
| |
Set vertex normal.
- Parameters
-
idx | The index of the normal. |
normal | Normal. |
- Returns
- If the index does not exist in the mesh false is returned
◆ color()
Color color |
( |
int |
idx | ) |
const |
Returns the vertex color at vertex idx.
- Returns
- Color of vertex.
If idx is bigger than the vertex count or if there is no color information associated with the vertex (0,0,0) is returned.
◆ setColor()
bool setColor |
( |
int |
idx, |
|
|
const Color & |
color |
|
) |
| |
Set vertex color.
- Parameters
-
idx | The index of the color. |
color | Color. |
- Returns
- If the index does not exist in the mesh false is returned
◆ triangle()
Returns the specified triangle vertex indices.
- Returns
- Triangle information.
If idx is bigger than the triangle count the (0,0,0) is returned.
◆ addTriangle()
int addTriangle |
( |
const Triangle & |
triangle | ) |
|
Add triangle consisting of the given vertex indices.
- Parameters
-
- Returns
- The index of the triangle or -1 in case of failure
◆ center()
Get mesh bounding box center.
- Returns
- Bounding box center
◆ extent()
Get mesh bounding box extent.
- Returns
- Bounding box extent
◆ save()
bool save |
( |
const char * |
filename, |
|
|
MeshFormat |
format |
|
) |
| |
Save mesh to file.
- Parameters
-
filename | File to save mesh to. |
format | Mesh format. |
- Returns
- True if successful, false on error.
◆ transform()
void transform |
( |
const Mat3 & |
R, |
|
|
const Vec3 & |
t |
|
) |
| |
Transform mesh with the given rotation and translation.
- Parameters
-
R | 3x3 rotation matrix |
t | Translation vector |
◆ decimate()
bool decimate |
( |
int |
minEdgeLength, |
|
|
int |
maxEdgeLength, |
|
|
bool |
preserveColors |
|
) |
| |
Decimate mesh.
- Parameters
-
minEdgeLength | Minimum edge length in decimated mesh. |
maxEdgeLength | Maximum edge length in decimated mesh. |
preserveColors | If set to true color is taken into account when decimating the mesh. Areas with high color variation will be decimated less. |
- Returns
- True if successful, false on error.
◆ smooth()
bool smooth |
( |
int |
iterations | ) |
|
Smooth mesh.
- Parameters
-
iterations | Number of smoothing iterations. |
- Returns
- True if successful, false on error.
◆ clean()
bool clean |
( |
double |
minComponentArea, |
|
|
double |
maxComponentArea |
|
) |
| |
Clean mesh by removing connected components with certain surface area.
- Parameters
-
minComponentArea | Minimum surface area of components to remove. |
maxComponentArea | Maximum surface area of components to remove. |
- Returns
- True if successful, false on error.
◆ crop()
bool crop |
( |
const Vec3 & |
boxCenter, |
|
|
const Vec3 & |
boxExtent, |
|
|
const bool |
discardPointsInside = false |
|
) |
| |
Crop mesh with given bounding box.
- Parameters
-
boxCenter | Center of mesh bounding box in mesh coordinate system |
boxExtent | Extent of mesh bounding box along mesh X, Y and Z axis |
discardPointsInside | If set to true, points inside of the bounding box will be discarded |
- Returns
- True if successful, false otherwise.
◆ fillHoles()
bool fillHoles |
( |
int |
level = -1 | ) |
|
Fill holes in mesh to make it manifold.
- Parameters
-
level | of the remeshing. If set to -1 it is chosen automatically based on the original volume resolution. Level l roughly corresponds to a volume resolution of 2^l. |
- Returns
- True if successful, false otherwise
◆ makeHollow()
bool makeHollow |
( |
double |
wall | ) |
|
Make mesh hollow.
Input mesh has to be manifold.
- Parameters
-
wall | wall strength in mm. Reasonable values are in the range of 2-5 mm. |
- Returns
- True if successful, false on error.
◆ removeBoundaryFaces()
bool removeBoundaryFaces |
( |
int |
layers | ) |
|
Remove boundary faces from the mesh.
- Parameters
-
layers | number of mesh boundary layers |
- Returns
- True if successful, false on error.
◆ isManifold()
bool isManifold |
( |
| ) |
const |
Checks mesh manifoldness, i.e.
whether the mesh is watertight
- Returns
- True if mesh is manifold, false otherwise.
◆ applyTexture()
Apply texture mapping to the mesh.
- Returns
- True if successful, false on error.
The documentation for this class was generated from the following file:
- E:/BuildAgent/work/97cc5eac790048b1/RecFusionSDK/include/Mesh.h