thin_medial_mesh ¶
Remove medial tets and unimportant faces by topology-preserving thinning.
Medial meshes computed from a power diagram may contain medial tets:
four spheres whose four triangles are all medial faces. Each tet is
removed by collapsing a tet-face simple pair (the
face with the smallest importance first); then, among the faces of those
tets, faces with importance < threshold are pruned through their free
edges (face-edge simple pairs). Collapsing simple pairs does not change
the topology of the medial mesh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
C
|
(n,3) numpy double array
|
Sphere centers. |
required |
R
|
(n,) numpy double array
|
Sphere radii. |
required |
E
|
(e,2) numpy int array
|
Medial edges. |
required |
F
|
(f,3) numpy int array
|
Medial faces. |
required |
importance
|
(f,) numpy double array
|
Importance of each face, for example the length of the dual edge of
the restricted power diagram over the average sphere diameter, as
returned by |
required |
threshold
|
float
|
Faces of medial tets with |
required |
Returns:
| Name | Type | Description |
|---|---|---|
E_out |
(e',2) numpy int array
|
Remaining medial edges (indices into |
F_out |
(f',3) numpy int array
|
Remaining medial faces (indices into |
Notes
Only faces that belong to a medial tet are candidates for pruning; a medial mesh without tets is returned unchanged.
C++: void libmat::thin_medial_mesh(C, R, E, F, importance, threshold,
E_out, F_out) in <libmat/thin_medial_mesh.h>.
Examples:
import numpy as np
import libmat
# four spheres forming a medial tet, plus one extra face
C = np.array([[0., 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 1]])
R = np.full(5, 0.3)
F = np.array([[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [1, 2, 4]])
importance = np.array([0.9, 0.1, 0.2, 0.8, 1.0])
E_out, F_out = libmat.thin_medial_mesh(C, R, None, F, importance, 0.5)
print(F_out) # the low-importance faces of the tet are gone
C++¶
#include <libmat/thin_medial_mesh.h>
// Topology-preserving thinning of a medial mesh: medial tetrahedra (four vertices
// whose four triangles are all medial faces) are removed by collapsing
// tet-face simple pairs in order of increasing face importance, then faces of
// those tets with importance below `threshold` are pruned through their free
// edges (face-edge simple pairs). Pruning simple pairs preserves topology.
//
// Inputs:
// C #V by 3 sphere centers
// R #V sphere radii
// E #E by 2 medial edges
// F #F by 3 medial faces
// importance #F importance of each face (e.g. the length of the dual
// power-diagram edge over the average sphere diameter)
// threshold faces with importance >= threshold are kept
// Outputs:
// E_out #E' by 2 remaining edges (indices into C)
// F_out #F' by 3 remaining faces (indices into C)
void thin_medial_mesh(const Eigen::MatrixXd& C, const Eigen::VectorXd& R,
const Eigen::MatrixXi& E, const Eigen::MatrixXi& F,
const Eigen::VectorXd& importance, double threshold,
Eigen::MatrixXi& E_out, Eigen::MatrixXi& F_out);