read_tet_mesh ¶
Read a tetrahedral mesh from a .msh, .tet or .vtk file.
Supports gmsh .msh files (e.g. produced by
fTetWild), the plain-text
.tet format and legacy .vtk unstructured grids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the tet mesh file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
V |
(n,3) numpy double array
|
Vertex positions. |
T |
(m,4) numpy int array
|
Tetrahedra, as 0-based indices into |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the file cannot be read. |
See Also
extract_surface : boundary triangle mesh of a tet mesh.
Notes
C++: bool libmat::read_tet_mesh(path, V, T) in <libmat/read_tet_mesh.h>.
Examples:
C++¶
#include <libmat/read_tet_mesh.h>
// Read a tetrahedral mesh from a .msh (gmsh v2/v4, e.g. from fTetWild),
// .tet or .vtk file.
//
// Inputs:
// path path to the tet mesh file
// Outputs:
// V #V by 3 vertex positions
// T #T by 4 tetrahedra (0-based vertex indices)
// Returns true on success.
bool read_tet_mesh(const std::string& path, Eigen::MatrixXd& V,
Eigen::MatrixXi& T);