I test more cases with my 2D dual contouring script. Here are some updates.

Touching vertex

When the isopleth hits the grid vertex, duplicated vertices may be generated. See figure below.

Touching vertex

The touching grid point(the black one) will have duplicated vertices generated in the red cells. Then these vertices will overlap at the black grid point.

My solution is to omit the edge which has one side with zero value and the other side with positive value. I mark this kind of edges with bold black color in the figure.

Solution outside the cell

Sometimes a solution of pseudoinverse will be outside the cell:

Solution outside the cell

Here is a sample data set: The first intersection is (0.17391304, -0.84122239) with normal vector (0.27874198, -0.41094215); The second intersection is (0.26083516, -0.7826087) with normal vector (0.40979725, -0.60430874).

In this case I simply set the solution to the center of the cell.

Incorrect topology

Currently I construct edges from one grid cell to its four adjacent neighbors. This approach will generate incorrect topology when it encounters sharp features.

Here is an example of upper part of heart function:

Incorrect topology in heart function

The red part forms an incorrect “bridge”-like mesh. I do not find a solution yet.