mymesh.implicit#

Implicit function meshing tools

An implicit function f(x,y,z) describes a surface in 3D where the surface is located on the f(x,y,z) = 0 isosurface. The default convention used in this module is that values less than zero are considered “inside” the surface, and values above zero are considered “outside”.

Mesh Generation#

VoxelMesh(func, bounds, h[, threshold, ...])

Generate voxel mesh of an implicit function

SurfaceMesh(func, bounds, h[, threshold, ...])

Generate a surface mesh of an implicit function

TetMesh(func, bounds, h[, threshold, ...])

Generate a tetrahedral mesh of an implicit function

SurfaceNodeOptimization(M, func, h[, ...])

Optimize the placement of surface node to lie on the "true" surface.

Implicit Functions#

gyroid(x, y, z)

Implicit function approximation of the gyroid triply periodic minimal surface (TPMS).

lidinoid(x, y, z)

Implicit function approximation of the lidinoid triply periodic minimal surface (TPMS).

primitive(x, y, z)

Implicit function approximation of the primitive (Schwarz P) triply periodic minimal surface (TPMS).

neovius(x, y, z)

Implicit function approximation of the neovius triply periodic minimal surface (TPMS).

diamond(x, y, z)

Implicit function approximation of the diamond (Schwarz D) triply periodic minimal surface (TPMS).

cylinder(center, radius)

Implicit function of a cylinder.

box(x1, x2, y1, y2, z1, z2)

Implicit function of a box.

xplane(x0[, n])

Implicit function of a plane whose normal direction is along the x axis.

yplane(y0[, n])

Implicit function of a plane whose normal direction is along the y axis.

zplane(z0[, n])

Implicit function of a plane whose normal direction is along the z axis.

sphere(center, radius)

Implicit function of a sphere.

torus(center, R, r)

Implicit function of a torus oriented about the z-axis.

Implicit Function Operators#

offset(fval, value)

Offset function values by a prescribed amount.

union(fval1, fval2)

Boolean union of two values or sets of values.

diff(fval1, fval2)

Boolean difference of two values or sets of values.

thicken(fval, t)

Thicken an isosurface by offsetting in both directions.

intersection(fval1, fval2)

Boolean intersection of two values or sets of values.

unionf(f1, f2)

Boolean union of two functions.

difff(f1, f2)

Boolean difference of two functions.

intersectionf(f1, f2)

Boolean intersection of two functions.

thickenf(f, t)

Thicken an implicit function by offsetting in both directions.

unions(symfun1, symfun2)

Boolean union of two symbolic functions.

diffs(symfun1, symfun2)

Boolean difference of two symbolic functions.

intersections(symfun1, symfun2)

Boolean intersection of two symbolic functions.

thickens(symfun, t)

rMax(a, b[, alpha, m, p])

rMin(a, b[, alpha, m, p])

Other Implicit Mesh Utilities#

mesh2sdf(M, points[, method])

Generates a signed distance field for a mesh.

mesh2udf(M, points)

Generates an unsigned distance field for a mesh.

grid2fun(VoxelCoords, VoxelConn, Vals[, ...])

Converts a voxel grid mesh into a function that can be evaluated at any point within the bounds of the grid.

grid2grad(VoxelCoords, VoxelConn, NodeVals)

Converts a voxel grid mesh into a function.