Problem 46746. Volume of a truncated cube
The surface of a truncated cube consists of 6 octagons, and 8 equilateral triangles. Our truncated cube is parametrised by (h1, h2), where
- h1 refers to the distance between the center of the volume and the center of the octagons, and
- h2 refers to the distance between the center of the volume and the center of the triangles.
For we get the special case of a cube, and for we get a cuboctahedron.
Your task: Write a function which returns the volume V of the truncated cube as function of the heights h1 and h2. If the ratio h2/h1 violates the constraints return the volume of the related special case (cube or cuboctahedron) instead.
Solution CommentsShow comments
Problem Recent Solvers6