Message Boards Message Boards

0
|
5859 Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Plot a polyhedron/region trapped between 4 planes?

Posted 7 years ago

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.

POSTED BY: Amir Baghban
6 Replies

Do you want to plot this one?

RegionPlot3D[x + y + z <= 1, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}]

enter image description here

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]

enter image description here

Posted 7 years 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 BY: Amir Baghban

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]]
POSTED BY: Gianluca Gorni

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]

enter image description here

Posted 7 years ago

Dear friends, sorry for my special question of my general one. I think my specialization was not suitable. My main problem is that: I have a set of some planes in 3D. I want to plot the region trapped between them (if there exists) and the quantity "4" was an example for my general question.

POSTED BY: Amir Baghban

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]

enter image description here

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.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract