# Why is RegionMeasure so slow when calculating intersection area of a 2D and a 3D object?

If you think this description is too long, you can read the problem directly

I know normally when one wants to calculate an region, this guide is useful. However, when it comes to calculating an intersection of a plane and a solid figure, this Integrate and Boole method seems to be complicated.

Since version 10, there are some new function related with Regions, which provide a more elegant way to express the problem, so I hoped to solve the problem this way.

Here is an example problem(from somewhere else). Suppose we want to calculate the intersection area of a tetrahedron and a plane. The classical way to solve would be like this:

Show[RegionPlot3D[
2 Sqrt[3] x + 6 y + Sqrt[6] z <= 3 &&
3 + 6 y >= 2 Sqrt[3] x + Sqrt[6] z &&
3 + 4 Sqrt[3] x >= Sqrt[6] z && 1 + Sqrt[6] z >= 0, {x, -2,
2}, {y, -2, 2}, {z, -2, 2}, PlotPoints -> 100],
ContourPlot3D[
Sqrt[3] x == 3 y + Sqrt[6] z, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]]


And an classical way to solve would be like this (code taken from somewhere else):

Block[{dA, z},
z = z /. Solve[Sqrt[3] x == 3 y + Sqrt[6] z, z][[1]];
dA = Sqrt[1 + D[z, x]^2 + D[z, y]^2];
Integrate[
Boole[Sqrt[3] x == 3 y + Sqrt[6] z &&
2 Sqrt[3] x + 6 y + Sqrt[6] z <= 3 &&
3 + 6 y >= 2 Sqrt[3] x + Sqrt[6] z &&
3 + 4 Sqrt[3] x >= Sqrt[6] z && 1 + Sqrt[6] z >= 0]*
dA, {x, -Infinity, Infinity}, {y, -Infinity, Infinity}]]
(*1*)


My attempt was to express the problem with graphic objects: Tetrahedron and InfinitePlane.

Graphics3D[{Tetrahedron[{{0, 0, Sqrt[3/2]}, {2/Sqrt[3],
0, -(1/Sqrt[6])}, {-(1/Sqrt[3]),
1, -(1/Sqrt[6])}, {-(1/Sqrt[3]), -1, -(1/Sqrt[6])}}],
InfinitePlane[{{0, 0, 0}, {Sqrt[3], 1, 0}, {Sqrt[2], 0, 1}}]}]


Problem

However, when I tried this:

RegionMeasure@
RegionIntersection[
Tetrahedron[{{0, 0, Sqrt[3/2]}, {2/Sqrt[3],
0, -(1/Sqrt[6])}, {-(1/Sqrt[3]),
1, -(1/Sqrt[6])}, {-(1/Sqrt[3]), -1, -(1/Sqrt[6])}}],
InfinitePlane[{{0, 0, 0}, {Sqrt[3], 1, 0}, {Sqrt[2], 0, 1}}]]


The code is going to evaluate forever, even some subtle change like changing RegionMeasure to Area won't help. (The analytical result seems to be relatively easy to obtain by geometry.) Am I making any mistake in this process?

My concern is that this problem is indeed quite simple, but required some effort to solve in Mathematica. Is there an easier way?

• Region functions seem to be in their adolescence. In V9, it would have been easier, in that there was no RegionIntersection to tempt you and you would have done the problem via analysis. RegionMeasure@ RegionIntersection[<whatever>] is a very general approach applied to a rather special, and simple, problem. Probably general methods are being applied that take a long time. I haven't experimented much in 10.1, but in 10.0, it was clear that RegionIntersection did ok if the intersection had the same dimension as the regions being intersected; otherwise, it would never finish. – Michael E2 Jul 8 '15 at 15:49
• @MichaelE2 Things like this RegionMeasure@RegionIntersection[Ball[{0, 0, 0}, 2], Ball[{1, 1, 1}, 2]] // AbsoluteTiming returns unable to calculate message after about 400secs. – happy fish Jul 8 '15 at 16:02
• @Felix That (in your comment) is hard for Integrate too, but quick with NIntegrate. Volume has Method -> "NIntegrate" but that seems to hang as well – Szabolcs Jul 8 '15 at 16:10
• @MichaelE2 But actually mathematica is able to calculate region intersections with different dimensions: RegionMeasure@RegionIntersection[Ball[], InfinitePlane[{{0, 0, 0}, {1, 1, 0}, {0, 1, 0}}]] returns \[Pi] Immediately – happy fish Jul 8 '15 at 16:11
• @Szabolcs Yeah... may be mathematica only uses integration instead of summing up the volume of two spherical caps – happy fish Jul 8 '15 at 16:14

In[1]:= Timing@RegionMeasure@N@