1

I have been using scipy.spatial.Delaunay() till now to perform Delaunay triangulations of point sets. However, this often leads to the creation of skinny triangles, which I am trying to avoid. I was told here that MeshPy provides a wrapper to Shewchuk's Triangle, which allows for the construction of high-quality, adjustable meshes.

However, I have been not been able to find any sample code for creating a Delaunay triangulation using Meshpy, given only the nodes. The MeshPy site gives this basic example in 3d:

from meshpy.tet import MeshInfo, build

mesh_info = MeshInfo()
mesh_info.set_points([
    (0,0,0), (2,0,0), (2,2,0), (0,2,0),
    (0,0,12), (2,0,12), (2,2,12), (0,2,12),
    ])
mesh_info.set_facets([
    [0,1,2,3],
    [4,5,6,7],
    [0,4,5,1],
    [1,5,6,2],
    [2,6,7,3],
    [3,7,4,0],
    ])
mesh = build(mesh_info)

But supplying facets (or triangles) by hand is precisely what I don't want to do.

Note: The website for Triangle (http://www.cs.cmu.edu/~quake/triangle.delaunay.html) shows some quick code for Delaunay triangulation. But how would I do this in MeshPy?

ap21
  • 2,372
  • 3
  • 16
  • 32

1 Answers1

1

If you're unhappy with the quality of your triangular mesh, perhaps optimesh (a project of mine) is worth taking a look. Install with

pip install optimesh

and use it on the command line like

optimesh in.vtk out.e

You can also use it from within Python.

enter image description here

Nico Schlömer
  • 53,797
  • 27
  • 201
  • 249
  • Thank you. This looks nice. I was unable to tell from the website, what exactly are the inputs required for `optimesh` to generate its mesh? Do the points suffice? Or can we just give a geometric region (say, a disk) defined by a parametric equation? – ap21 Oct 18 '19 at 15:46
  • @ap21 It's a mesh _optimizer_, so you'll need a mesh, i.e., points and cells. – Nico Schlömer Oct 18 '19 at 20:02
  • 1
    Thank you. I see that `meshzoo` is another project of yours for generating meshes for simple surfaces. Very useful! – ap21 Oct 20 '19 at 23:28