OManifold.Sdf3
3d signed-distance functions (convertible to mesh/manifold via a level set algorith)
val sphere : float -> t
val cube : ?round:float -> OCADml.v3 -> t
val torus : OCADml.v2 -> t
val cylinder : ?round:float -> height:float -> float -> t
val to_mmeshgl :
?level:float ->
?edge_length:float ->
box:OCADml.Box3.t ->
t ->
{mmeshgl}2
to_mmeshgl ?level ?edge_length ~box t
Constructs a level-set Mesh from the signed-distance function t
. This uses a form of Marching Tetrahedra (akin to Marching Cubes, but better for manifoldness). Instead of using a cubic grid, it uses a body-centered cubic grid (two shifted cubic grids). This means if your function's interior exceeds the given bounds, you will see a kind of egg-crate shape closing off the manifold, which is due to the underlying grid. The output is guaranteed to be manifold, thus should always be an appropriate input to Manifold.of_mmeshgl
.
box
is and axis-aligned bounding box defining the extent of the grid overwhich t
is evaluatededge_length
is the the approximate maximum edge length of the triangles in the final result. This affects grid spacing, thus strongly impacting performance.level
can be provided with a positive value to inset the mesh, or a negative value to outset it (default is 0.
-- no offset)