Most solid

Yusuke Endoh

Judges' comments:

To build:

make endoh4

To run:



NOTE: The author recommends the use of xterm.

./endoh4 < cube.txt

For example, if you are a soccer fan, try:

make all
./endoh4 < solids/archimedian-solid/a11-truncated-icosahedron.txt

Selected Judges Remarks:

This program is formatted as the net for a tetrahedron. (hint, try feeding the program it’s own source code). When it runs there is an animation for the computation to work out the convex hull.

Author’s comments:


This is a convex polyhedron viewer, which:

  1. reads three-dimentional vertices (3N float values) from stdin,
  2. calculates a convex hull of them, and
  3. renders it.

This simple spec involves many details.

(Note that this program does not use math.h.)


I think it conforms with both C89 and C99. I confirmed that it worked on gcc, clang, and tcc. It should not be warned with -pedantic and -Wextra.


You may want to use tput to hide a terminal cursor.

tput civis
./endoh4 < cube.txt
tput cnorm


You can change the screen size. Let the aspect ratio be about 3:1.

gcc -DS=120,40 -o endoh4 endoh4.c

The shape of this code is the geometric net of a regular tetrahedron. So, try:

./endoh4 < endoh4.c

The solids.tbz2 file includes various solid data: Platonic solids, Archimedean solids, Prisms, Antiprisms, Bipyramids, Trapezohedrons, and Johnson solids.

I created the files by using the POV-Ray scripts (1 and 2) in Wikipedia. They are copyrighted in CC BY-SA 3.0 by “User:Cyp” and “User:AndrewKepert”.

Creative Commons License

© Copyright 1984-2015, Leo Broukhis, Simon Cooper, Landon Curt Noll - All rights reserved
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.