Volume of a 3D square prism variation

70 Views Asked by At

Background

I'm trying to calculate the volume of a shape that I don't know the name of. So, I'll describe the shape using an example.

Starting with a simple square prism - with a base of 1 x 1 and a height of 2, the 8 vertex points could be:

(x, y, z)
0, 0, 0
0, 0, 2
1, 0, 0
1, 0, 2
0, 1, 0
0, 1, 2
1, 1, 0
1, 1, 2

The shape I'm trying to work with only varies from this in the sense that the z values can be different for each vertex point:

(x, y, z)
0, 0, 0
0, 0, 2.25
1, 0, 0.1
1, 0, 2.5
0, 1, 0.2
0, 1, 2.75
1, 1, 0.3
1, 1, 3

Questions:

  1. What is the name of this shape?
  2. How do I calculate the volume of it?
1

There are 1 best solutions below

1
On BEST ANSWER

As already mentioned in the comments, it must be guaranteed that your solid is well defined, i.e. that all four bottom vertices lie on a plane and all four top vertices lie on a plane. This means (assuming that the vertices always have the same order) $$ z_1+z_7 = z_3+z_5 \\ z_2+z_8 = z_4+z_6 $$ which is true in your example. So I assume you were aware of that restriction.

Now we can simply use the height in the center of the solid to calculate the volume. The $z$-coordinates of the centers of the bottom face and the top face are: $$ z_B = \frac{z_1+z_7}{2} = \frac{z_3+z_5}{2} = \frac{z_1+z_3+z_5+z_7}{4} $$ and $$ z_T = \frac{z_2+z_8}{2} = \frac{z_4+z_6}{2} = \frac{z_2+z_4+z_6+z_8}{4} $$ and the volume is $$ V= 1\cdot 1 \cdot |z_T - z_B| = |z_T - z_B| $$ This can be shown e.g. by taking a second solid with the same shape, cut it into two pieces (perpendicular to the z-axis), flip the pieces and glue them at the corresponding bottom face and top face. The result will be a cuboid with a $1\times 1$ base and a height of $2|z_T - z_B|.$

By the way, I don't know if your solid has a special name.