13

Bug introduced in 10.0.0 and fixed in 10.0.2


Consider the following ImplicitRegion:

reg = ImplicitRegion[x^2 + y^2 + z^2 == 16, {x, y, z}];

We can discretize it using DiscretizeRegion

dr = DiscretizeRegion[reg]

Mathematica graphics

To get finer triangles the option MaxCellMeasure is available, only it does nothing when used.

DiscretizeRegion[reg, MaxCellMeasure -> {"Area" -> #}] & /@ {0.1, 0.05}

Mathematica graphics

Of course using one of the Graphics primitives

DiscretizeRegion[Ball[], MaxCellMeasure -> {"Area" -> #}] & /@ {0.1, 0.05}

Mathematica graphics

You can see that it works fine. I'm on Windows 8.1, can anyone confirm this on other platforms? Confirmed on Linux via the Wolfram Programming Cloud.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
RunnyKine
  • 33,088
  • 3
  • 109
  • 176

2 Answers2

5

Edit: Wolfram Technical Support has confirmed this as a bug

The only workaround I know is to turn the MeshRegion into a BoundaryMeshRegion and triangulate the resulting mesh object:

dr = DiscretizeRegion[reg, MaxCellMeasure -> {"Area" -> 0.05}];

Then:

TriangulateMesh[BoundaryMeshRegion[MeshCoordinates[dr], MeshCells[dr, 2]], 
                                               MaxCellMeasure -> #] & /@ {0.1, 0.005}

Mathematica graphics

It seems like another workaround is to repeatedly apply DiscretizeRegion which is definitely a weird approach. ( Thanks to Michael E2 )

Rest @ NestList[DiscretizeRegion, reg, 2]

Mathematica graphics

RunnyKine
  • 33,088
  • 3
  • 109
  • 176
  • DiscretizeRegion[dr, MaxCellMeasure -> {"Area" -> 0.01}] produces similar results. Note that the outer function (DiscretizeRegion or TriangulateMesh) subdivides a mesh region and does not attempt to approximate the implicit region. Perhaps someone will come along and let us know whether implicit regions can be approximated with arbitrary precision. – Michael E2 Aug 05 '14 at 12:26
  • @MichaelE2, That's an interesting find. So basically, One has to discretize the result of DiscretizedRegion to see the effect. That makes no sense. – RunnyKine Aug 05 '14 at 15:20
  • 1
    @MichaelE2, This bug is also present in DiscretizeGraphics and has been sort-of confirmed by @user21. – RunnyKine Aug 05 '14 at 15:21
  • Well, this is a bug (or lack of implementation?) and by all means, you should report this. – user21 Aug 06 '14 at 07:17
  • @user21, I already reported it and linked to this page. – RunnyKine Aug 06 '14 at 07:27
1

To get finer triangles the option MaxCellMeasure is available, only it does nothing when used.

This is fixed in 10.0.2. on windows 7, 64 bit

Mathematica graphics

Mathematica graphics

Nasser
  • 143,286
  • 11
  • 154
  • 359
  • But the same bug in DiscretizeGraphics was never fixed. I just stumbled upon it (https://mathematica.stackexchange.com/questions/238758/change-mesh-density-of-graphics3d-object-made-of-triangles/238759#238759) – ap21 Jan 25 '21 at 06:15