# Plot a polyhedron/region trapped between 4 planes?

Posted 11 months ago
1141 Views
|
6 Replies
|
0 Total Likes
|
 I need to plot the region trapped between 4 planes x = y = z = x + y + z - 1 = 0. Here, is the code that I used: RegionPlot3D[ContourPlot3D[x == 0, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}], ContourPlot3D[y == 0, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}], ContourPlot3D[z == 0, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}], ContourPlot3D[x + y + z - 1 == 0, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]] But, there are other extra bits that I do not know how to delete them.
6 Replies
Sort By:
Posted 11 months ago
 Do you want to plot this one? RegionPlot3D[x + y + z <= 1, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}] Or, may be this one? Graphics3D[{EdgeForm[{Thick, Blue}], FaceForm[{Pink, Opacity[0.7]}], Tetrahedron[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {0, 0, 0}}]}, Boxed -> False] 
Posted 11 months ago
 Dear Valeriu, I would like to plot a polyhedron trapped between four arbitrary surfaces not only a polyhedron between the coordinate surfaces and other one.
Posted 11 months ago
 Dear Amir,You may use the following approach: RegionPlot3D[ Subscript[x, 1] + Subscript[x, 2] + Subscript[x, 3] <= 3 && Subscript[x, 1] - Subscript[x, 2] >= -1 && Subscript[x, 2] - Subscript[x, 3] >= -1 && Subscript[x, 3] >= 0, {Subscript[x, 1], -2, 4}, {Subscript[x, 2], -2, 4}, {Subscript[x, 3], -2, 4}, PlotPoints -> 75, PlotStyle -> Directive[Orange, Opacity[0.5]], Mesh -> None] 
Posted 11 months ago
 As suggested by Valeriu, you can use Tetrahedron if you give the vertices: vertices = RandomReal[{0, 1}, {4, 3}]; Graphics3D[Tetrahedron[vertices]] Graphics3D[Map[InfinitePlane, Subsets[vertices, {3}]], PlotRange -> CoordinateBounds[vertices], PlotRangePadding -> Scaled[.2]] If you start from the equations of the 4 faces, you can extract the vertices by solving the equations first: equations = {x == 0, y == 0, z == 0, x + y + z - 1 == 0}; vertices = Map[{x, y, z} /. First@Solve[#] &, Subsets[equations, {3}]]; Graphics3D[Tetrahedron[vertices]] 
 You may use the same approach, e.g.: RegionPlot3D[ x^2 + y^2 + z^2 <= 1 && -x + y + Sin[z]^2 <= 1 && x - y + z <= 1 && x + y - z <= 1 && -x - y + z <= 1 && -x + y - z <= 1 && x - y - z <= 1 && -x^2 - y - z^2 <= 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotPoints -> 75, PlotStyle -> Directive[Orange, Opacity[0.777]], Mesh -> None] Nevertheless, there are some difficulties. If you have 4 surfaces, then the number of possible "polyhedra" is 16. Some of them are not polyhedra but polyhedral sets, i.e.unbounded sets.