RegionUnion works but RegionIntersection does notrgwonesags 2de h40 1kikniac Ca067sen P8alpile
I am trying to create an Alberti's window figure as described in this question, in which a (three-dimensional) polyhedron (e.g., dodecahedron) is projected onto a (two-dimensional) plane. I realized that the previous approach and solution of projecting points is not quite what I need. Instead, I'd like to project two-dimensional faces (in this case pentagons). Everything works except the final stage. Here's how I proceed:
1) Here are the vertices of the dodecahedron:
myVertices = N@PolyhedronData["Dodecahedron", "Vertices"];
2) Here are the grouped indices of each pentagon face:
myFaces = PolyhedronData["Dodecahedron", "Faces"];
3) Here are the selected faces that are visible from the center of projection:
mySelectedFaces = myFaces[[#]] & /@ {2, 3, 5, 6, 7};
4) Here is the center of projection:
cop = {10, 0, 0};
5) Here are the three-dimensional cones defined by a pentagon face on the dodecahedron and the center of projection:
myCones = Join[#, {cop}] & /@ (myVertices[[#]] & /@ mySelectedFaces);
6) Here's the region mesh of just the first such cone:
myConeMesh = ConvexHullMesh[myCones[[1]]]

7) I'm projecting onto a plane defined by:
poly = Polygon[{{6, -2, -2}, {6, -2, 2}, {6, 2, 2}, {6, 2, -2}}];
8) If I create the union of the cone and the projection plane, I get just what I expect:
RegionUnion[myConeMesh, poly]

9) But of course I want instead the intersection of the cone and the projection plane. That should give me a pentagon floating in the plane of the projection plane. (I could then color it, render it however I wish, and so forth.) However, when I implement what I think should be the obvious function, I do not get the desired intersection:
RegionIntersection[myConeMesh, poly]

I have tried all manner of putting the elements in braces, creating Mesh or ConvexHullMesh, etc., without success. I thought the problem might stem from the embedding dimension, but both component regions are in three dimensions.
How can I compute the pentagon intersection region within the projection plane?
1 Answer
Here's one workaround.
Since your clip-plane is axes aligned, we can use the 2 argument form of DiscretizeRegion to clip the solid in one direction, then manually pick the faces on the plane.
(If your clip-plane is not axes aligned, you could rotate your whole scene, clip, then rotate back.)
x = 6.;
clip = BoundaryDiscretizeRegion[myConeMesh, {{-1, x}, {-1, 1}, {-1, 2}}];
int = MeshRegion[
MeshCoordinates[clip],
Pick[MeshCells[clip, 2], PropertyValue[{clip, 2}, MeshCellCentroid][[All, 1]], x]
];
Show[
MeshRegion[int, BaseStyle -> ColorData[112, 1], PlotTheme -> "Minimal"],
BoundaryMeshRegion[myConeMesh, BaseStyle -> Opacity[.3], PlotTheme -> "Minimal"]
]

-
1$\\begingroup$ Indeed, your result gives the floating pentagon, as needed (thanks), but this is such a kludgy workaround. I will be performing lots of these kinds of projections—onto planes of arbitrary orientation—that rotating, clipping, and so forth is simply unwieldy. Do you have any insight as to why the straightforward
RegionIntersectiondoesn't work? $\\endgroup$ – David G. Stork 7 hours ago -
$\\begingroup$ Indeed a messy workaround. I don't really know why
RegionIntersectiondoesn't work, but note thatRegionUnionsimply places both region into the same scene and doesn't resolve their intersections. You can see this withRegionUnion[myConeMesh, poly] // ConnectedMeshComponents.RegionIntersectionon the other hand must find the intersections. $\\endgroup$ – Chip Hurst 7 hours ago -
$\\begingroup$ I figured out a better workaround: Define
poly = Cuboid[{5.9,-2,-2},{6,2,2}]. This three-dimensional region then works. The earlier problem must be due to something about intrinsic dimension. $\\endgroup$ – David G. Stork 7 hours ago -
$\\begingroup$ Technically that's not a plane, but you could then manually pick out the faces like in my answer. Also
BoundaryDiscretizeRegion[myConeMesh, {{x - .001, x}, {-1, 1}, {-1, 2}}]works like this too. $\\endgroup$ – Chip Hurst 7 hours ago -
$\\begingroup$ Anyway.... thanks for your help (+1)... but not a full accept, since I have a sense someone will see through the fundamental problem and come to a true planar solution. $\\endgroup$ – David G. Stork 7 hours ago