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 h_2 = \sqrt{3} h_1 we get the special case of a cube, and for h_2 = (2\sqrt3)/3 h_1 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 (2\sqrt3)/3 <= h_2 / h_1 <= \sqrt3 return the volume of the related special case (cube or cuboctahedron) instead.

Solution Stats

45 Solutions

8 Solvers

Last Solution submitted on Aug 04, 2024

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...