3
$\begingroup$

I'm trying to get an intersection boundary of a prism's surface and a plane:

prism = Entity["Polyhedron",{"Prism", 6}] plane = InfinitePlane[prism["VertexCoordinates"][[{4, 6, 11}]]] RegionIntersection[plane, prism["ImplicitRegion"]] 

DiscretizeRegion turns it into 2D face, but I can't for the life of me extract the boundary of it. RegionBoundary doesn't work, it works as an identity and doesn't lower region's dimension. I've also tried everything with prism["MeshRegion"] and prism["BoundaryMeshRegion"].

$\endgroup$
5
  • 1
    $\begingroup$ Wow, I was going to suggest you use the method described here to get the intersection - and it would in principle work. But if you execute Length[MeshPrimitives[ EntityValue[ Entity["Polyhedron", {"Prism", 6}], "MeshRegion"], 2] ] you see that the mesh region for this entity has almost 24,000 polygons! $\endgroup$ Commented Feb 17, 2017 at 23:13
  • $\begingroup$ @JasonB. It kinda works Cases[RegionIntersection[plane, #] & /@ MeshPrimitives[DiscretizeGraphics@prism["Faces"], 2], _Line], not exactly perfect, but good enough... $\endgroup$ Commented Feb 17, 2017 at 23:25
  • 1
    $\begingroup$ Still would love some Region solution, discretizing graphics feels wrong to me $\endgroup$ Commented Feb 17, 2017 at 23:29
  • $\begingroup$ in general Region functions don't work for 3D regions as well. You can tweak your solution to give a polygon, polygon = Cases[RegionIntersection[plane, #] & /@ MeshPrimitives[DiscretizeGraphics@prism["Faces"], 2], Line[{a_, b_}] :> Sequence[a, b]] // (#[[Last@FindShortestTour[#]]] &) // Polygon; Graphics3D@polygon $\endgroup$ Commented Feb 17, 2017 at 23:43
  • 1
    $\begingroup$ @JasonB. Luckily for us, the "BoundaryMeshRegion" property gives us a region with a minimal amount of polygons. We can get a MeshRegion from this with only 12 tetrahedron with TriangulateMesh[prism["BoundaryMeshRegion"], MaxCellMeasure -> Infinity]. $\endgroup$ Commented Feb 20, 2017 at 14:18

1 Answer 1

3
$\begingroup$

A potential work around is to express this region in terms of graphics regions.

prism = Entity["Polyhedron", {"Prism", 6}]; plane = InfinitePlane[prism["VertexCoordinates"][[{4, 6, 11}]]]; pts = prism["VertexCoordinates"]; prisms = Prism[pts[[#]]] & /@ {{1, 3, 5, 2, 4, 6}, {5, 9, 11, 6, 10, 12}, {7, 3, 11, 8, 4, 12}, {3, 5, 11, 4, 6, 12}}; Graphics3D[prisms] 

enter image description here

ints = RegionIntersection[#, plane] & /@ prisms 
{ Line[{{-1/2, -Sqrt[3]/2, 1/2}, {-1/2, Sqrt[3]/2, 1/2}}], Triangle[{{-1/2, Sqrt[3]/2, 1/2}, {1/2, Sqrt[3]/2, -1/6}, {1, 0, -1/2}}], Triangle[{{-1/2, -Sqrt[3]/2, 1/2}, {1, 0, -1/2}, {1/2, -Sqrt[3]/2, -1/6}}], Triangle[{{-1/2, -Sqrt[3]/2, 1/2}, {-1/2, Sqrt[3]/2, 1/2}, {1, 0, -1/2}}] } 
final = Polygon[Rest[ints][[All, 1]]]; Graphics3D[final] 

enter image description here

At this point one could figure out a way to merge the three triangles into a 5 sided polygon.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.