2
$\begingroup$

Consider a truncated pyramid bounded by two rectangles:

Rectangle[{-100, -125}, {100, 125}]
Rectangle[{-200, -250}, {200, 250}]

The first rectangle is located at z = -1948 and the other one is at z = 2578.

Is it possible to plot this figure using Graphics3D?

$\endgroup$

1 Answer 1

5
$\begingroup$

Arbitrarily assuming two heights:

h1 = 0;
h2 = 100;


pts = {{-200, -250, h1}, {-200, 250, h1}, {200, 250, h1}, {200, -250, 
    h1},
   {-100, -150, h2}, {-100, 150, h2}, {100, 150, h2}, {100, -150, h2}
   };
polyh = ConvexHullRegion[pts]

Graphics3D[{polyh
  }
 , BoxRatios -> {1, 1, 1}
 , Axes -> Automatic
 ]

enter image description here


EDIT

To have non-colored sides use Glow and adjust Opacity as desired:

Graphics3D[{
  Glow[White]
  , Opacity[0.5]
  , polyh
  }
 , BoxRatios -> {1, 1, 1}
 , Axes -> Automatic
 ]

enter image description here


EDIT 2

Using Region functionality:

p1 = Pyramid[{{-200, -250, h1}, {-200, 250, h1}, {200, 250, 
    h1}, {200, -250, h1}, {0, 0, 200}}]

RegionQ /@ {p1, Cuboid[{-200, -250, h1}, {200, 250, h2}]}

{True, True}

Region[Style[
  RegionIntersection[p1, Cuboid[{-200, -250, h1}, {200, 250, h2}]], 
  Darker@Cyan]
 , BoxRatios -> {1, 1, 1}, Boxed -> True, Axes -> True]

enter image description here

$\endgroup$
4
  • $\begingroup$ Thanks! Is it also possible to not fill the sides of this figure with colors? $\endgroup$ Commented May 6, 2022 at 8:24
  • 1
    $\begingroup$ @JohnTaylor Please see update. $\endgroup$
    – Syed
    Commented May 6, 2022 at 8:36
  • $\begingroup$ Thanks again. Which version of Mathematica you are using? In my version of Mathematica (12.1), ConvexHullRegion is not defined. $\endgroup$ Commented May 6, 2022 at 8:49
  • 1
    $\begingroup$ "12.2.0 for Microsoft Windows (64-bit) (December 12, 2020)" on Win7-x64. $\endgroup$
    – Syed
    Commented May 6, 2022 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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