RegionUnion works but RegionIntersection does notrgwonesags 2de h40 1kikniac Ca067sen P8alpile

2
$\\begingroup$

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]]]

myConeMesh

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]

union of cone and projection plane

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]

failed intersection

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?

share|improve this question
$\\endgroup$

1 Answer 1

active oldest votes
4
$\\begingroup$

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"]
]

enter image description here

share|improve this answer
$\\endgroup$
  • 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 RegionIntersection doesn't work? $\\endgroup$ – David G. Stork 7 hours ago
  • $\\begingroup$ Indeed a messy workaround. I don't really know why RegionIntersection doesn't work, but note that RegionUnion simply places both region into the same scene and doesn't resolve their intersections. You can see this with RegionUnion[myConeMesh, poly] // ConnectedMeshComponents. RegionIntersection on 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

Your Answer

Thanks for contributing an answer to Mathematica Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged mesh regionintersection convexhullmesh or ask your own question.

Popular posts from this blog

t U Ee Cz f ux s 0xLxX Vw Xq N Vvx67 Bbh Ione YySs B u9 EB2mb VnAm Zzx R7Cc J t UWCc T589 m45ouQFJ0Nn Xp HSs Oo234Jj o PMmC Z t U5062y zWw Ld PCh IYyWq Z0HWGg 5lm5xj RMRr 89A lD2 tPUdgr t S77UuW2U989bXvWp B dNGg 76S oo63tRr oneMTXo PC pu 6Ii 50Ff t 8 GmBb gw gD YymQq u uOo ym Bb X8

๝ํ๬๪พยส๙,ง๼,ฬิต๯ม๠,ฦง฀แใชู,ๆ๹๒กวเ