Message Boards Message Boards

Rendering of RegionIntersection in 3D?

GROUPS:

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:
Answer
6 days ago

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]

Regards Mariusz.

POSTED BY: Mariusz Iwaniuk
Answer
7 hours ago

Group Abstract Group Abstract