1
$\begingroup$

Currently my 3D model have too many meshs/polygons. My model is simple, in the sense that it is only a Union of a box and a cylinder. But after BoundaryDiscretizeRegion, the mesh count is ~2000.

Here's my model:

cube = Cuboid[] // Graphics3D // DiscretizeGraphics;
cylinder = Cylinder[{{0, 0, -2}, {0, 0, 2}}, 1] // Graphics3D // DiscretizeGraphics;
shape = RegionUnion[cube, cylinder] // BoundaryDiscretizeRegion

And the mesh count with MeshCellCount[shape] is:

{1444, 4326, 2884}

This is problematic when I export said model to stl. Is it possible to merge some of the useless mesh regions? For example the cube surface that is not connected to the cylinder can ideally be represented by a single mesh.

$\endgroup$
  • $\begingroup$ Since you use RegionUnion on MeshRegion, your Mathematica version is 11.2. Right ? $\endgroup$ – andre314 Feb 8 '18 at 7:23
  • $\begingroup$ Why is problematic? resolution?, file size? manage the .stl model? Please, elaborate $\endgroup$ – José Antonio Díaz Navas Feb 8 '18 at 8:16
1
$\begingroup$

Use MaxCellMeasure:

cube = Cuboid[];
cylinder = Cylinder[{{0, 0, -2}, {0, 0, 2}}, 1];
shape = BoundaryDiscretizeRegion[RegionUnion[cube, cylinder], 
  MaxCellMeasure -> Infinity]

enter image description here

MeshCellCount[shape]
{466, 1392, 928}
| improve this answer | |
$\endgroup$
  • $\begingroup$ Is it possible to take the triangulation on the top of the cylinder and unwrap that into a coarser one? I'm picturing how I'd do this with SketchUp where I'd represent that with just two triangles (assuming triangulation). $\endgroup$ – b3m2a1 Feb 8 '18 at 7:50
  • $\begingroup$ @b3m2a1, not that I can think of. $\endgroup$ – user21 Feb 8 '18 at 8:00
  • $\begingroup$ Ah I forgot to mention that I tried to adjust the MaxCellMeasure parameter. I still think there are too many 'useless' triangles generated. For example the central top region should be combined into a single polygon, if possible. $\endgroup$ – capsensitive Feb 8 '18 at 17:52
  • $\begingroup$ But maybe this is the only possible way. Since it does make things better. $\endgroup$ – capsensitive Feb 8 '18 at 17:56

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.