0
$\begingroup$

The question is exactly as the title: Which 2D (triangular) mesh generator software can be used which has a set of geometric primitives, controlled mesh size and standard output (.vtk or something similar)?

For testing my code I need a triangular mesh for a circle and I am looking for the easiest way to do that. E.g., in 3D case for a sphere I am happy to use NETGEN with several lines of code to get meshes with controlled mesh size and standard output format.

Can anyone give me a recommendation?

Thanks!

$\endgroup$

2 Answers 2

2
$\begingroup$

Shewchuk's triangle mesh generator produces high quality meshes and is quite robust. However, the boundary definition is a series of straight lines. So to produce a sequence of refined meshes over a circle you would also have to refine the definition of the boundary for each mesh.

Another option is Persson's distmesh triangle mesher, As shown on this page, only two lines of MATLAB (or Octave) code are required to mesh a circle

fd=@(p) sqrt(sum(p.^2,2))-1;
[p,t]=distmesh2d(fd,@huniform,0.2,[-1,-1;1,1],[]);

And the mesh can be refined by changing a single "mesh density" parameter with no changes to the geometry definition.

You can conveniently use MATLAB to write the coordinate matrix, p, and the connectivity matrix, t, in whatever format you choose. And, as I've verified, it also runs in Octave if you don't have access to MATLAB.

$\endgroup$
1
  • $\begingroup$ Thought the same about the Triangle. distmesh seems to be exactly what I need right now, thank you! $\endgroup$
    – VorKir
    Commented Feb 21, 2017 at 22:03
1
$\begingroup$

You can use Jonathan Shewchuk's triangle mesh generator [1]. It has its own file format, but it can be easily translated. If you plan to embed it in another software, it can be also compiled as a library with an easy to use API. You can also use CGAL [2], a large piece of software with many functionalities (including 2D mesh generation).

[1] https://www.cs.cmu.edu/~quake/triangle.html

[2] http://www.cgal.org

$\endgroup$
1
  • $\begingroup$ Thanks for the ideas. I had some experience with Triangle, but somehow I was sure that it is difficult to make a circle there (are you sure it is possible?), I will look more carefully, as well as have a look at CGAL. $\endgroup$
    – VorKir
    Commented Feb 21, 2017 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.