Volume meshingΒΆ

import openturns as ot
import otmeshing

Generate a tetrahedron point cloud and build its convex hull surface

tetra_pts = ot.Sample(
    [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
)
hull = otmeshing.ConvexHullMesher()
surface = hull.build(tetra_pts)
print("surface: vertices=", surface.getVerticesNumber(),
      "facets=", surface.getSimplicesNumber())
surface: vertices= 4 facets= 4

Tetrahedralize the surface with the centroid strategy

volume (centroid): 5 vertices, 4 tets, volume= 0.16666666666666666

First-vertex strategy produces the same volume but fewer tetrahedra

volume (first): 4 vertices, 1 tets, volume= 0.16666666666666666

Cube example

cube volume: 12 tets, volume= 1.0