Bug introduced in 10.4 and persists through 11.1

In answering this question, I realized the OP and I were obtaining different results from the alphaShapes2D code. This question was updated with additional point sets, but when I tried to use my answer there, it failed. The OP used my answer and got really good results which made me realize something has changed between Mathematica versions 10.3.1 and 10.4. I think I may have tracked the problem down to DelaunayMesh. To see what I mean, here are the MeshRegions generated from the data obtained from the linked question using the same alpha parameter (10.4 is on the right of the following images):

alphaShapes2D[points, 3.0]

Mathematica graphics

You can see it's more pronounced if we try to extract the region boundaries:

Mathematica graphics

When I tried to apply the code to the second data set provided (points2), Mathematica 10.3.1 returns the nice result shown in the linked question whereas, 10.4 fails to return any useful result. After spending some time debugging the only thing I could come up with is that DelaunayMesh is doing something different in both versions. For instance the number of mesh cells returned in both versions are different:

dd = DelaunayMesh[points];
MeshCellCount[dd, All]

Mathematica graphics Mathematica graphics

Also, as you can see from above, in 10.4 DelaunayMesh claims there's a degenerate polygon but we don't see this error in 10.3.1. Can anyone reproduce this? Is this a change in algorithm in DelaunayMesh?

  • $\begingroup$ Same behavior for me (OS X, mma 10.3.1 / 10.4). $\endgroup$
    – SquareOne
    Mar 22, 2016 at 8:18

1 Answer 1


The problem arises from the definition of ellipsePoints in the linked question, which maps over a range of angles Range[0, 2 Pi, 0.02 Pi]. Because the range includes both 0 and 2 Pi, there are duplicate points in the data. Simply changing to Range[0.02 Pi, 2 Pi, 0.02 Pi] makes the problem go away.

enter image description here

  • 1
    $\begingroup$ So, do you consider this new behavior a bug given that it worked fine pre 10.4? Or is it the correct behavior? I personally think the algorithm should be smart enough to remove duplicate points. $\endgroup$
    – RunnyKine
    Mar 28, 2017 at 3:03
  • $\begingroup$ @RunnyKine I'm not sure. The point is not perfectly duplicated due to roundoff errors. The triangulation works okay (it uses TriangleDelaunay from the TriangleLink package) and treats the points as distinct, but MeshRegion seems to treat them as equal. The inconsitency could be regarded as a bug. $\endgroup$ Mar 28, 2017 at 15:54

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.