fem.sdf_to_hex_mesh
fem.sdf_to_hex_mesh(sdf, grid, *, snap=True)
Extract a HEX8 volume mesh from an SDF on a regular grid.
Cells whose center lies inside (sdf < 0) are kept, sharing vertices through the lattice. With snap=True boundary vertices within one cell diagonal of the zero set are Newton-projected onto the surface along the field gradient, with total displacement clamped to half the cell diagonal; a vertex is left unsnapped if moving it would invert any incident hex (corner-tet volume check).
Parameters
| sdf |
Callable[[Any], Any] |
Signed distance field callable on (..., 3) points. |
required |
| grid |
GridSpec |
Sampling lattice. |
required |
| snap |
bool |
Project boundary vertices onto the zero set. |
True |
Returns
|
HexMesh |
The extracted :class:HexMesh. |
Raises
|
ValueError |
If no cell center lies inside the field. |