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

46 Solutions

9 Solvers

Last Solution submitted on May 30, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers9

Suggested Problems

More from this Author4

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!