How can I create an evenly distributed mesh from a shape?

116 Views Asked by At

I'm trying to convert some 2D shapes (without holes) into meshes with evenly distributed vertices.

Before the conversion the shapes are edge loops with no internal vertices.

After the conversion I want the following properties.

  • Every edge vertex should connect to some internal vertex.
  • The added vertices should be evenly placed within the shape or on the edge.
  • No added edge should cross outside the shape.

  • A parameter should be able to regulate how many vertices are added, like maximum edge length, minimum vertex density or some such thing. It doesn't matter all that much as long as the mesh doesn't end up very dense or sparse in the interior.

I'm going map vectors to the vertices in the end, that's why I want to create meshes with internal vertices.

1

There are 1 best solutions below

0
On BEST ANSWER

The devil is in the details, but the backbone of the algorithm would be as follows:

Given some desired maximum edge length $m$

1) refine the edges of the shape so no edge is longer than $m$. Let $V$ be the set of all resulting vertices.

2) compute the Delauney triangulation $T$ of $V$

3) add to $V$ vertices that are the centroids of the triangles in $T$ that have edges longer than $m$.

4) update the Delauney triangulation $T$ of $V$. If $T$ has triangles with edges longer than $m$, go to step 3).

5) Optionally smooth the distribution of vertices by computing each interior vertex to be the average of its neighbors.

For more details see Sections 5 and 6 of Filling Holes in Meshes and the references there.