1
$\begingroup$

Problem

On the sphere, it is easy to control the resolution of the mesh in DiscretizeGraphics using the MaxCellMeasure attributes of Length and Area.

But these tricks do not seem to work on the cuboid. For example, varying the length from 1000 to 0.001 produces this same mesh.

DiscretizeGraphics[Graphics3D[Cuboid[{0, 0, 0}, {50, 3, 4}]], MaxCellMeasure -> {"Length" -> 10.0}]

Mesh

Question

How does one control the mesh resolution in this case?

$\endgroup$
  • $\begingroup$ Is there a reason not to use DiscretizeRegion since both return a MeshRegion? Something like DiscretizeRegion[Cuboid[{0, 0, 0}, {50, 3, 4}], MaxCellMeasure -> {"Length" -> 10.0}]. $\endgroup$ – Tim Laska Jul 13 at 23:56
  • $\begingroup$ @Tim Laska: This is a great start. The length decreases as expected until 3, then at 2, the mesh reverts. Can you address this and post your comment as an answer so it can be selected? $\endgroup$ – dantopa Jul 14 at 1:16
  • $\begingroup$ MeshTools package can help you to precisely control the number of elements / mesh size. See the function HexahedronMesh. $\endgroup$ – Pinti Jul 14 at 20:03
2
$\begingroup$

Both DiscretizeGraphics and DiscretizeRegion return a MeshRegion. DiscretizeRegion is more precise.

A mesh level of "2" does not appear to work because the thickness of the lines are too faint. One can use HighlightMesh to see the discretization more clearly.

HighlightMesh[
   DiscretizeRegion[Cuboid[{0, 0, 0}, {50, 3, 4}], 
    MaxCellMeasure -> {"Length" -> #}], Style[1, Red]] & /@ 
 Range[2, 10]

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.