A new feature added in Mathematica 11.2 gives the ability to easily plot region intersection (see this post, scroll down to 3D Computational Geometry
).
However, I can't seem to understand how to find the intersection of following objects:
contourRegionPlot3D[region_, {x_, x0_, x1_}, {y_, y0_, y1_}, {z_, z0_, z1_},
opts : OptionsPattern[]] := Module[{reg, preds},
reg = LogicalExpand[region && x0 <= x <= x1 && y0 <= y <= y1 && z0 <= z <= z1];
preds = Union@Cases[reg, _Greater | _GreaterEqual | _Less | _LessEqual, -1];
Show @ Table[ContourPlot3D[
Evaluate[Equal @@ p], {x, x0, x1}, {y, y0, y1}, {z, z0, z1},
RegionFunction -> Function @@ {{x, y, z}, Refine[reg, p] && Refine[! reg, ! p]},
opts], {p, preds}]]
shift = {1.2, 1, 1};
heart = ImplicitRegion[((y - shift[[1]])^2 + (9 (x - shift[[2]])^2)/ 4 + (z -
shift[[3]])^2 - 1)^3 - (y - shift[[1]])^2 (z - shift[[3]])^3 - (9 (x -
shift[[2]])^2 (z - shift[[3]])^3)/80 < 0, {x, y, z}];
heartPlot = RegionPlot3D[
heart,
PlotRange -> {{-0.5, 2.5}, {-2.5, 2.5}, {-0.5, 2.5}},
PlotPoints -> 30,
PlotStyle -> Directive[lightBlue, Opacity[0.4]]
];
arcRegion = 1.4 < x^2 + y^2 < 1.6 && 1.4 < z < 1.6 && 1 \[Pi]/64 < ArcTan[x, y] < 27 \[Pi]/64;
arcRegionPlot = contourRegionPlot3D[arcRegion, {x, 0.1, 2}, {y, 0.1, 2}, {z, 1.2, 1.8}];
RegionIntersection[
heartPlot // DiscretizeGraphics,
arcRegionPlot // DiscretizeGraphics
]
And here's what I get as an output:
What am I doing wrong here? I know that those 2 regions for sure intersect: