Message Boards Message Boards

GROUPS:

Rendering of RegionIntersection in 3D?

Posted 10 months ago
900 Views
|
1 Reply
|
1 Total Likes
|

I am trying to visualize some region intersections in 3D.

Example 1:

ra = 10;
ri = 5;

R1 = RegionDifference[Ball[{0, 0, 0}, ra], Ball[{0, 0, ri - 1/2}, ri]];
Show[R1 // Region, Axes -> True]

rendered result

The resulting rendered region has a hole, while it should not have one. Does anyone know a way to improve on this.

Another example.

Example 2:

ra = 10;
ri = 5;

R1 = RegionDifference[Ball[{0, 0, 0}, ra], Ball[{0, 0, 0}, ri]];
R2 = Cylinder[{{-100, 0, 0}, {100, 0, 0}}, 5];

R = RegionIntersection[R1, R2] // Region

The resulting region is rendered with jagged edges.

The rendered result of Example2

How can this rendering be improved? I know that the rendered edges can not be infinitely sharp like in the mathematical world, but I think some improvement should be possible. Does anyone know how to achieve this? I am using Mathematica 11.1 on Windows.

Thanks for your help. Maarten

Attachments:

Hello I'm send e-mail to WRI and give me an answer:

Hello,Thank you for contacting Wolfram Technical Support. I understand that Region is rendering poorly. I have filed a report with our developers suggestion that they implement an option like MaxCellMeasure and PlotPoints so that render quality can be improved. That being said, you normally can apply DiscretizeRegion to a RegionDifference, then use the MaxCellMeasure in DiscretizeRegion. This works for some of the examples in your notebook. However, there are known issues with applying DiscretizeRegion to a RegionIntersection that prevents this from being done in some examples. For the last example, I've been able to reproduce the error messages and I also am not able to abort the evaluation. I will report this to our developers. Thank you for bringing this to our attention. Regards, Luke Titus Wolfram Technical Support Wolfram Research Inc.

I have a code, works a little better:

    ra = 10;
    ri = 5;
    R1 = RegionDifference[Ball[{0, 0, 0}, ra], Ball[{0, 0, 0}, ri]];
    R2 = Cylinder[{{-100, 0, 0}, {100, 0, 0}}, 5];
    DiscretizeRegion[RegionIntersection[R1, R2], MaxCellMeasure -> 0.02]

EDITED: 10 March 2018:

In Mathematica 11.3:

   ra = 10;
   ri = 5;
   g1 = Ball[{0, 0, 0}, ra];
   g2 = Ball[{0, 0, 0}, ri];
   g3 = Cylinder[{{-100, 0, 0}, {100, 0, 0}}, 4.55];
   R1 = BoundaryDiscretizeGraphics[g1, MaxCellMeasure -> {"Length" -> 2}];
   R2 = BoundaryDiscretizeGraphics[g2, MaxCellMeasure -> {"Length" -> 2}];
   R3 = BoundaryDiscretizeGraphics[g3, MaxCellMeasure -> {"Length" -> 2}];
   RZ = RegionDifference[R1, R2];
   R = Region[RegionIntersection[RZ, R3]]

enter image description here

Regards ,MI

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract