Skip to content

extract_surface

extract_surface(V, T)

Extract the boundary triangle mesh of a tetrahedral mesh.

Boundary faces are the tet faces that belong to a single tetrahedron. They are oriented so that their normals point outwards.

Parameters:

Name Type Description Default
V (n,3) numpy double array

Tet mesh vertex positions.

required
T (m,4) numpy int array

Tetrahedra.

required

Returns:

Name Type Description
SV (k,3) numpy double array

Surface vertex positions.

SF (f,3) numpy int array

Surface triangles, as indices into SV.

sf2tet (k,) numpy int array

Index of each surface vertex in V, i.e. SV == V[sf2tet].

Notes

C++: void libmat::extract_surface(V, T, SV, SF, sf2tet) in <libmat/extract_surface.h>.

Examples:

import libmat
V, T = libmat.read_tet_mesh("data/lblock.tet")
SV, SF, sf2tet = libmat.extract_surface(V, T)
print(SF.shape)   # (2800, 3)

C++

#include <libmat/extract_surface.h>

// Extract the boundary triangle mesh of a tetrahedral mesh, with faces
// oriented outwards.
//
// Inputs:
//   V  #V by 3 tet mesh vertex positions
//   T  #T by 4 tetrahedra
// Outputs:
//   SV      #SV by 3 surface vertex positions
//   SF      #SF by 3 surface triangles (indices into SV)
//   sf2tet  #SV map from surface vertex to tet mesh vertex: SV = V(sf2tet,:)
void extract_surface(const Eigen::MatrixXd& V, const Eigen::MatrixXi& T,
                     Eigen::MatrixXd& SV, Eigen::MatrixXi& SF,
                     Eigen::VectorXi& sf2tet);