1
$\begingroup$

I am using MMA 11.0.1.0, tested on both Ubuntu 64-bit and Windows 10 64-bit. The documentation has a nice example with a capsule:

enter image description here

Both plotting and explicit discretizing works perfectly, the code is

capsule = 
  RegionUnion[Ball[{0, 0, 0}, 1], Cylinder[{{0, 0, 0}, {2, 0, 0}}, 1],
    Ball[{2, 0, 0}, 1]];
RegionPlot3D[capsule, BoxRatios -> Automatic, PlotPoints -> 40]
DiscretizeRegion@capsule

However, when I make a union with more of the same objects (Ball and Cylinder), I run into problems. Consider this pipe network:

capillaryRadius = 0.000012; (*m *)
zCoord := 0.0000864;
node1 = {-0.000212, -0.000151, zCoord};
node2 = {-0.0001655, -0.0002305, zCoord};
node3 = {-0.0000835, -0.000044, zCoord};
node4 = {-0.0000225 , -0.000093, zCoord};

nodePrimitives = 
  Ball[#, capillaryRadius] & /@ {node1, node2, node3, node4};
segmentPrimitives = 
  Cylinder[#, capillaryRadius] & /@ {{node1, node3}, {node1, 
     node2}, {node2, node3}, {node3, node4}, {node2, node4}};
Graphics3D[{Red, nodePrimitives, segmentPrimitives}]

enter image description here

So far these are just separate objects. Now let us form a RegionUnion and repeat the same things we did with the capsule:

network = RegionUnion@Join[nodePrimitives, segmentPrimitives];
RegionPlot3D[network, BoxRatios -> Automatic, PlotPoints -> 100]
DiscretizeRegion@network

Unfortunately RegionPlot3D plots an empty box and DiscretizeRegion returns this error message:

DiscretizeRegion::drf: DiscretizeRegion was unable to discretize the region RegionUnion[<<9>>].

Note that DiscretizeRegion@RegionUnion@nodePrimitives works fine, but DiscretizeRegion@RegionUnion@segmentPrimitives returns the same kind of error message as above, something must be up with those cylinders!

Bug reported to Wolfram CASE:3983297.

$\endgroup$
3
$\begingroup$

It works with version 11.2 after you have replaced

network = RegionUnion @ Join[nodePrimitives, segmentPrimitives] 

by

network = RegionUnion @@ Join[nodePrimitives, segmentPrimitives]  

Because I can only use Version 11.2 in the cloud, I had to limit PlotPoint to 50. The result is then :

enter image description here

This works too :

DiscretizeRegion @ network

enter image description here

I confirm that RegionPlot3D and DiscretizeRegion don't work on 11.0 (neither with @ nor @@)

Otherwise it seems that :

  • RegionUnion accepts both syntaxes @ and @@ in version 11.0

  • RegionUnion only accepts @@ in version 11.2

| improve this answer | |
$\endgroup$
  • $\begingroup$ Something related : One interesting progress in 11.2 is that RegionUnion works with MeshRegion, for example : RegionUnion @@ (DiscretizeRegion /@ {Cuboid[],Cuboid[{0.5,0.5,0.5}]}) is OK. The impossiblity to apply RegionUnion on MeshRegion in 11.0 is documented. See the doc RegionUnion -> Possible issues $\endgroup$ – andre314 Dec 15 '17 at 18:35
  • $\begingroup$ Thank you! Will do my best to get 11.2 from my Uni asap. $\endgroup$ – Alexander Erlich Dec 15 '17 at 18:50
  • $\begingroup$ Any thoughts on a possible workaround for 11.0.1.0? It will be a while until I get access to 11.2, and I need to be able to do DiscretizeRegion @ network sooner. $\endgroup$ – Alexander Erlich Dec 16 '17 at 20:42
  • $\begingroup$ @AlexanderErlich I don't have any solution and I'm rather pessimistic because I have played several hours with this kind of thing on version 11.0. in the past (I don't remember the details). Even version 11.2 isn't very polished (see here for example) $\endgroup$ – andre314 Dec 16 '17 at 21:08

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.