read_surface_mesh ¶
Read a triangle mesh from a file.
Any format supported by geogram can be read (.obj, .off, .ply,
.stl, .mesh, .geogram, ...). Polygonal faces are triangulated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the surface mesh file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
V |
(n,3) numpy double array
|
Vertex positions. |
F |
(m,3) numpy int array
|
Triangles, as 0-based indices into |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the file cannot be read. |
Notes
C++: bool libmat::read_surface_mesh(path, V, F) in
<libmat/read_surface_mesh.h>.
Examples:
C++¶
#include <libmat/read_surface_mesh.h>
// Read a triangle mesh from any format supported by geogram
// (.obj, .off, .ply, .stl, .mesh, .geogram, ...). Polygonal faces are
// triangulated.
//
// Inputs:
// path path to the surface mesh file
// Outputs:
// V #V by 3 vertex positions
// F #F by 3 triangles (0-based vertex indices)
// Returns true on success.
bool read_surface_mesh(const std::string& path, Eigen::MatrixXd& V,
Eigen::MatrixXi& F);