DistMesh.jl implements simplex refinement on signed distance functions, or anything that has a sign, distance, and called like a function. The algorithm was first presented in 2004 by Per-Olof Persson, and was initially a port of the corresponding Matlab Code.
In layman's terms, a simplex is either a triangle in the 2D case, or a tetrahedra in the 3D case.
When simulating, you other want a few things from a mesh of simplices: - Accurate approximation of boundaries and features - Adaptive mesh sizes to improve accuracy - Near-Regular Simplicies
DistMesh is designed to address the above.
The basic processes is as follows:
DistMesh generally has a very low memory footprint, and can refine without additional memory allocation. Similarly, since the global state of simplex qualities is accounted for in each refinement iteration, this leads to very high quality meshes.
Aside from the above, since DistMesh works on signed distance functions it can handle complex and varied input data that are not in the form of surface meshes (Piecewise Linear Complicies).
Given the same parameters, the Julia implementation of DistMesh will generally perform 4-60 times faster than the MatLab implementation. Delaunay Triangulation in MatLab uses QHull, whereas DistMesh.jl uses TetGen.
Here are some libraries that turn gridded and level set data into an approximate signed distance function:
Use Tetrahedral quality analysis to control the meshing process
iso (default: 0): Value of which to extract the iso surface, inside negative deltat (default: 0.1): the fraction of edge displacement to apply each iteration
A struct returned from the
distmesh function that includes point, simplex, and interation statistics.
Takes Keyword arguments as follows:
iso (default: 0): Value of which to extract the isosurface, inside surface is negative deltat (default: 0.1): the fraction of edge displacement to apply each iteration sort (default:false): If true and no fixed points, sort points using a hilbert sort. sort_interval (default:20) Use hilbert sort after the specified retriangulations distribution (default: :regular) Initial point distribution, either :regular or :packed.
DistMeshStatistics Statistics about the convergence between iterations
Uniform edge length function.
Compute dihedral angles within a tetrahedra radians
distmesh 3D Mesh Generator using Signed Distance Functions. Arguments: fdist: Distance function fh: Edge length function h: Smallest edge length Returns: p: Node positions t: Triangle indices Example: Unit ball d(p) = sqrt(sum(p.^2))-1 p,t = distmeshnd(d,huniform,0.2)
Hilbert Sorting. If
carry is specified, this array will be permuted in line with the specified array.
Compute the minimum dihedral angle within a tetrahedra radians
Given a point set, generate a delaunay triangulation, and other requirements. This includes: - Spatial sorting of points - Delaunay triangulation - Filtering of invalid tetrahedra outside the boundary
Decompose tets to edges, using a pre-allocated array and set. Set ensures uniqueness, and result will be sorted.
convert tets to tris, returned sorted and unique
Determine the quality of a triangle given 3 points.
Points must be 3D.
returns the extrema elements (min, max) of the sampled qualities
Computes the volume and edge-length ratio from four given points
returns the (min, avg, max) of the sampled qualities