medial_mesh_from_spheres ¶
Connect medial spheres into a medial mesh with the restricted power diagram (CUDA).
The power diagram of the spheres is clipped by the input tet mesh on the GPU (restricted power diagram, RPD). Two spheres are connected by a medial edge when their restricted power cells share a face, and three spheres span a medial face when their cells share an edge.
Requires a build with CUDA (LIBMAT_WITH_CUDA=ON).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
V
|
(n,3) numpy double array
|
Tet mesh vertex positions. |
required |
T
|
(m,4) numpy int array
|
Tetrahedra. |
required |
C
|
(s,3) numpy double array
|
Medial sphere centers (same coordinates as |
required |
R
|
(s,) numpy double array
|
Medial sphere radii. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
E |
(e,2) numpy int array
|
Medial edges (indices into |
F |
(f,3) numpy int array
|
Medial faces (indices into |
importance |
(f,) numpy double array
|
Face importance (dual RPD edge length over the average sphere
diameter), to be used with |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If libmat was built without CUDA. |
Notes
C++: void libmat::medial_mesh_from_spheres(V, T, C, R, E, F,
importance) in <libmat/medial_mesh_from_spheres.h>, implemented in
src/cuda/api/.
Examples:
import libmat
V, T = libmat.read_tet_mesh("data/lblock.tet")
SV, SF, _ = libmat.extract_surface(V, T)
C, R, _ = libmat.shrink_spheres(SV, SF, num_spheres=1000)
if libmat.has_cuda():
E, F, importance = libmat.medial_mesh_from_spheres(V, T, C, R)
E, F = libmat.thin_medial_mesh(C, R, E, F, importance, 0.3)
Requires CUDA
Only available when libmat is built with LIBMAT_WITH_CUDA=ON, see Installation.
C++¶
#include <libmat/medial_mesh_from_spheres.h>
// [CUDA] Compute the medial mesh connecting a set of medial spheres, as the
// dual of their power diagram restricted to the input tet mesh (RPD): two
// spheres are connected by an edge if their
// restricted power cells share a face, and three spheres span a medial face
// if their restricted power cells share an edge.
//
// Requires a build with LIBMAT_WITH_CUDA=ON, throws std::runtime_error
// otherwise.
//
// Inputs:
// V #V by 3 tet mesh vertex positions
// T #T by 4 tetrahedra
// C #S by 3 medial sphere centers (same coordinates as V)
// R #S medial sphere radii
// Outputs:
// E #E by 2 medial edges (indices into C)
// F #F by 3 medial faces (indices into C)
// importance #F face importance (dual RPD edge length over the average
// sphere diameter), to be used with thin_medial_mesh()
void medial_mesh_from_spheres(const Eigen::MatrixXd& V,
const Eigen::MatrixXi& T,
const Eigen::MatrixXd& C,
const Eigen::VectorXd& R, Eigen::MatrixXi& E,
Eigen::MatrixXi& F, Eigen::VectorXd& importance);