Skip to content

Mesh from SDFs

The Sorotoki toolkit explores several routines for mesh generation, which are all contained in the class Mesh.m. Our primary focus is on using a modified version of the PolyMesher software developed by Talischi et al.1. Their work provided a stable foundation for generating unstructured meshes of PolyN elements. The approach starts by defining a material domain implicitly using SDFs. The number of elements is chosen a priori, and then repeated random sampling of the SDF is performed until the number of samples that fall within the specified domain matches the number of elements. A bounded Voronoi diagram is generated using the samples and the centers of the Voronoi cells are updated using Lloyd's algorithm2. To generate a mesh from an Sdf class, one can call msh = Mesh(Sdf) followed by msh = msh.generate().

Example: Mesh from SDF unit circle

Image title

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
% distance function
f = @(x) sqrt( x(:,1).^2 + x(:,2).^2 ) - 1.0;

% assigning @f to Sdf class
sdf = Sdf(f,'BdBox',[-2 2 -2 2]);

% mesh from sdf class
msh = Mesh(sdf);
msh = msh.generate('NElem',20);

% show mesh
msh.show();

Example: Mesh from SDF unit circle

Image title

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
% distance function
c   = sCircle(.25);    
r   = sRectangle(1);  
sdf = r.rotate(45)-c; 

% mesh from sdf class
msh = Mesh(sdf,'NElem',150);
msh = msh.generate();

% show mesh
msh.show();


  1. Cameron Talischi, Glaucio H. Paulino, Anderson Pereira, and Ivan F. M. Menezes. PolyTop: a Matlab implementation of a general topology optimization framework using unstructured polygonal finite element meshes. Structural and Multidisciplinary Optimization, 45(3):329–357, 2012. doi:10.1007/s00158-011-0696-x

  2. S. Lloyd. Least squares quantization in PCM. IEEE Transactions on Information Theory, 28(2):129–137, 1982. doi:10.1109/TIT.1982.1056489