Author:
- Name: Yusuke Endoh
Location: JP - Japan
To build:
make
If you wish to change the size (see the Author’s remarks
below) you can do so with the SIZE
variable. For instance you can do:
make clobber SIZE=50,50 all
but you can also do this directly with the endoh4.sh script as described below.
Bugs and (Mis)features:
The current status of this entry is:
STATUS: INABIAF - please DO NOT fix
For more detailed information see 2013/endoh4 in bugs.html.
To use:
./endoh4 < file
./endoh4.sh file
The second form is preferable as it will temporarily make the cursor invisible
as recommended by the author. If no file is specified in the ./endoh4.sh
command
line it will feed to the program endoh4.c.
Try:
./endoh4.sh cube.txt
Hit ctrl-c to end the program.
The author recommends the use of xterm.
For an example, if you are a football/soccer fan, try:
./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt
You can provide more than one file:
./endoh4.sh solids/archimedian-solid/a11-truncated-icosahedron.txt cube.txt
Hit ctrl-c/intr to go to the next file.
If you wish to change the size to 50,50
without passing any arg:
SIZE=50,50 ./endoh4.sh
Not specifying a file feeds endoh4.c to the program.
Judges’ remarks:
This program is formatted as the net for a tetrahedron (hint: try feeding the
program it’s own source code like ./endoh4.sh
). When it runs there is an
animation for the computation to work out the convex hull.
Author’s remarks:
Spec
This is a convex polyhedron viewer, which:
- reads three-dimensional vertices (3N float values) from
stdin
, - calculates a convex hull of them, and
- renders it.
This simple spec involves many details.
- 3D convex hull calculation
- recursive gift wrapping algorithm
- automatic merging of (almost) co-planar faces (i.e., faces are not triangulated)
- random perturbation for robustness
- 3D rendering
- perspective projection
- ASCII line drawing:
"',;;;,;'"
- camera in a spherical spiral orbit
(Note that this program does not use math.h
.)
Portability
I think it conforms with both C89 and C99. I confirmed that it worked on gcc,
clang, and tcc. It should not trigger warnings with -pedantic
and -Wextra
.
Tips
You may want to use tput
to hide the terminal cursor.
tput civis
./endoh4 < cube.txt
tput cnorm
or
./endoh4.sh cube.txt
Bonuses
You can change the screen size. Let the aspect ratio be about 3:1.
cc -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 # or ./endoh4.sh
The solids
directory includes various solid data:
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”.
Inventory for 2013/endoh4
Primary files
- endoh4.c - entry source code
- Makefile - entry Makefile
- endoh4.orig.c - original source code
- cube.txt - 3D object coordinates
- endoh4.sh - script to run entry without cursor
- solids/antiprism/a04-square-antiprism.txt - 3D object coordinates
- solids/antiprism/a05-pentagonal-antiprism.txt - 3D object coordinates
- solids/antiprism/a06-hexagonal-antiprism.txt - 3D object coordinates
- solids/antiprism/a07-heptagonal-antiprism.txt - 3D object coordinates
- solids/antiprism/a08-octagonal-antiprism.txt - 3D object coordinates
- solids/antiprism/a09-enneagonal-antiprism.txt - 3D object coordinates
- solids/antiprism/a10-decagonal-antiprism.txt - 3D object coordinates
- solids/archimedian-solid/a01-cuboctahedron.txt - 3D object coordinates
- solids/archimedian-solid/a02-great-rhombicosidodecahedron.txt - 3D object coordinates
- solids/archimedian-solid/a03-great-rhombicuboctahedron.txt - 3D object coordinates
- solids/archimedian-solid/a04-icosidodecahedron.txt - 3D object coordinates
- solids/archimedian-solid/a05-small-rhombicosidodecahedron.txt - 3D object coordinates
- solids/archimedian-solid/a06-small-rhombicuboctahedron.txt - 3D object coordinates
- solids/archimedian-solid/a07-snub-cube.txt - 3D object coordinates
- solids/archimedian-solid/a08-snub-dodecahedron.txt - 3D object coordinates
- solids/archimedian-solid/a09-truncated-cube.txt - 3D object coordinates
- solids/archimedian-solid/a10-truncated-dodecahedron.txt - 3D object coordinates
- solids/archimedian-solid/a11-truncated-icosahedron.txt - 3D object coordinates
- solids/archimedian-solid/a12-truncated-octahedron.txt - 3D object coordinates
- solids/archimedian-solid/a13-truncated-tetrahedron.txt - 3D object coordinates
- solids/bipyramid/b06-hexagonal-bipyramid.txt - 3D object coordinates
- solids/bipyramid/b07-heptagonal-bipyramid.txt - 3D object coordinates
- solids/bipyramid/b08-octagonal-bipyramid.txt - 3D object coordinates
- solids/bipyramid/b09-enneagonal-bipyramid.txt - 3D object coordinates
- solids/bipyramid/b10-decagonal-bipyramid.txt - 3D object coordinates
- solids/catalan-solid/c01-rhombic-dodecahedron.txt - 3D object coordinates
- solids/catalan-solid/c02-disdyakis-triacontahedron.txt - 3D object coordinates
- solids/catalan-solid/c03-disdyakis-dodecahedron.txt - 3D object coordinates
- solids/catalan-solid/c04-rhombic-triacontahedron.txt - 3D object coordinates
- solids/catalan-solid/c05-deltoidal-hexecontahedron.txt - 3D object coordinates
- solids/catalan-solid/c06-deltoidal-icositetrahedron.txt - 3D object coordinates
- solids/catalan-solid/c07-pentagonal-icositetrahedron.txt - 3D object coordinates
- solids/catalan-solid/c08-pentagonal-hexecontahedron.txt - 3D object coordinates
- solids/catalan-solid/c09-small-triakis-octahedron.txt - 3D object coordinates
- solids/catalan-solid/c10-triakis-icosahedron.txt - 3D object coordinates
- solids/catalan-solid/c11-pentakis-dodecahedron.txt - 3D object coordinates
- solids/catalan-solid/c12-tetrakis-hexahedron.txt - 3D object coordinates
- solids/catalan-solid/c13-triakis-tetrahedron.txt - 3D object coordinates
- solids/johnson-solid/j01-square-pyramid.txt - 3D object coordinates
- solids/johnson-solid/j02-pentagonal-pyramid.txt - 3D object coordinates
- solids/johnson-solid/j03-triangular-cupola.txt - 3D object coordinates
- solids/johnson-solid/j04-square-cupola.txt - 3D object coordinates
- solids/johnson-solid/j05-pentagonal-cupola.txt - 3D object coordinates
- solids/johnson-solid/j06-pentagonal-rotunda.txt - 3D object coordinates
- solids/johnson-solid/j07-elongated-triangular-pyramid.txt - 3D object coordinates
- solids/johnson-solid/j08-elongated-square-pyramid.txt - 3D object coordinates
- solids/johnson-solid/j09-elongated-pentagonal-pyramid.txt - 3D object coordinates
- solids/johnson-solid/j10-gyroelongated-square-pyramid.txt - 3D object coordinates
- solids/johnson-solid/j11-gyroelongated-pentagonal-pyramid.txt - 3D object coordinates
- solids/johnson-solid/j12-triangular-dipyramid.txt - 3D object coordinates
- solids/johnson-solid/j13-pentagonal-dipyramid.txt - 3D object coordinates
- solids/johnson-solid/j14-elongated-triangular-dipyramid.txt - 3D object coordinates
- solids/johnson-solid/j15-elongated-square-dipyramid.txt - 3D object coordinates
- solids/johnson-solid/j16-elongated-pentagonal-dipyramid.txt - 3D object coordinates
- solids/johnson-solid/j17-gyroelongated-square-dipyramid.txt - 3D object coordinates
- solids/johnson-solid/j18-elongated-triangular-cupola.txt - 3D object coordinates
- solids/johnson-solid/j19-elongated-square-cupola.txt - 3D object coordinates
- solids/johnson-solid/j20-elongated-pentagonal-cupola.txt - 3D object coordinates
- solids/johnson-solid/j21-elongated-pentagonal-rotunda.txt - 3D object coordinates
- solids/johnson-solid/j22-gyroelongated-triangular-cupola.txt - 3D object coordinates
- solids/johnson-solid/j23-gyroelongated-square-cupola.txt - 3D object coordinates
- solids/johnson-solid/j24-gyroelongated-pentagonal-cupola.txt - 3D object coordinates
- solids/johnson-solid/j25-gyroelongated-pentagonal-rotunda.txt - 3D object coordinates
- solids/johnson-solid/j26-gyrobifastigium.txt - 3D object coordinates
- solids/johnson-solid/j27-triangular-orthobicupola.txt - 3D object coordinates
- solids/johnson-solid/j28-square-orthobicupola.txt - 3D object coordinates
- solids/johnson-solid/j29-square-gyrobicupola.txt - 3D object coordinates
- solids/johnson-solid/j30-pentagonal-orthobicupola.txt - 3D object coordinates
- solids/johnson-solid/j31-pentagonal-gyrobicupola.txt - 3D object coordinates
- solids/johnson-solid/j32-pentagonal-orthocupolarotunda.txt - 3D object coordinates
- solids/johnson-solid/j33-pentagonal-gyrocupolarotunda.txt - 3D object coordinates
- solids/johnson-solid/j34-pentagonal-orthobirotunda.txt - 3D object coordinates
- solids/johnson-solid/j35-elongated-triangular-orthobicupola.txt - 3D object coordinates
- solids/johnson-solid/j36-elongated-triangular-gyrobicupola.txt - 3D object coordinates
- solids/johnson-solid/j37-elongated-square-gyrobicupola.txt - 3D object coordinates
- solids/johnson-solid/j38-elongated-pentagonal-orthobicupola.txt - 3D object coordinates
- solids/johnson-solid/j39-elongated-pentagonal-gyrobicupola.txt - 3D object coordinates
- solids/johnson-solid/j40-elongated-pentagonal-orthocupolarotunda.txt - 3D object coordinates
- solids/johnson-solid/j41-elongated-pentagonal-gyrocupolarotunda.txt - 3D object coordinates
- solids/johnson-solid/j42-elongated-pentagonal-orthobirotunda.txt - 3D object coordinates
- solids/johnson-solid/j43-elongated-pentagonal-gyrobirotunda.txt - 3D object coordinates
- solids/johnson-solid/j44-gyroelongated-triangular-bicupola.txt - 3D object coordinates
- solids/johnson-solid/j45-gyroelongated-square-bicupola.txt - 3D object coordinates
- solids/johnson-solid/j46-gyroelongated-pentagonal-bicupola.txt - 3D object coordinates
- solids/johnson-solid/j47-gyroelongated-pentagonal-cupolarotunda.txt - 3D object coordinates
- solids/johnson-solid/j48-gyroelongated-pentagonal-birotunda.txt - 3D object coordinates
- solids/johnson-solid/j49-augmented-triangular-prism.txt - 3D object coordinates
- solids/johnson-solid/j50-biaugmented-triangular-prism.txt - 3D object coordinates
- solids/johnson-solid/j51-triaugmented-triangular-prism.txt - 3D object coordinates
- solids/johnson-solid/j52-augmented-pentagonal-prism.txt - 3D object coordinates
- solids/johnson-solid/j53-biaugmented-pentagonal-prism.txt - 3D object coordinates
- solids/johnson-solid/j54-augmented-hexagonal-prism.txt - 3D object coordinates
- solids/johnson-solid/j55-parabiaugmented-hexagonal-prism.txt - 3D object coordinates
- solids/johnson-solid/j56-metabiaugmented-hexagonal-prism.txt - 3D object coordinates
- solids/johnson-solid/j57-triaugmented-hexagonal-prism.txt - 3D object coordinates
- solids/johnson-solid/j58-augmented-dodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j59-parabiaugmented-dodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j60-metabiaugmented-dodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j61-triaugmented-dodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j62-metabidiminished-icosahedron.txt - 3D object coordinates
- solids/johnson-solid/j63-tridiminished-icosahedron.txt - 3D object coordinates
- solids/johnson-solid/j64-augmented-tridiminished-icosahedron.txt - 3D object coordinates
- solids/johnson-solid/j65-augmented-truncated-tetrahedron.txt - 3D object coordinates
- solids/johnson-solid/j66-augmented-truncated-cube.txt - 3D object coordinates
- solids/johnson-solid/j67-biaugmented-truncated-cube.txt - 3D object coordinates
- solids/johnson-solid/j68-augmented-truncated-dodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j69-parabiaugmented-truncated-dodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j70-metabiaugmented-truncated-dodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j71-triaugmented-truncated-dodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j72-gyrate-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j73-parabigyrate-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j74-metabigyrate-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j75-trigyrate-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j76-diminished-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j77-paragyrate-diminished-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j78-metagyrate-diminished-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j79-bigyrate-diminished-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j80-parabidiminished-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j81-metabidiminished-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j82-gyrate-bidiminished-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j83-tridiminished-rhombicosidodecahedron.txt - 3D object coordinates
- solids/johnson-solid/j84-snub-disphenoid.txt - 3D object coordinates
- solids/johnson-solid/j85-snub-square-antiprism.txt - 3D object coordinates
- solids/johnson-solid/j86-sphenocorona.txt - 3D object coordinates
- solids/johnson-solid/j87-augmented-sphenocorona.txt - 3D object coordinates
- solids/johnson-solid/j88-sphenomegacorona.txt - 3D object coordinates
- solids/johnson-solid/j89-hebesphenomegacorona.txt - 3D object coordinates
- solids/johnson-solid/j90-disphenocingulum.txt - 3D object coordinates
- solids/johnson-solid/j91-bilunabirotunda.txt - 3D object coordinates
- solids/johnson-solid/j92-triangular-hebesphenorotunda.txt - 3D object coordinates
- solids/platonic-solid/p01-tetrahedron.txt - 3D object coordinates
- solids/platonic-solid/p02-cube.txt - 3D object coordinates
- solids/platonic-solid/p03-octahedron.txt - 3D object coordinates
- solids/platonic-solid/p04-dodecahedron.txt - 3D object coordinates
- solids/platonic-solid/p05-icosahedron.txt - 3D object coordinates
- solids/prism/p03-triangular-prism.txt - 3D object coordinates
- solids/prism/p05-pentagonal-prism.txt - 3D object coordinates
- solids/prism/p06-hexagonal-prism.txt - 3D object coordinates
- solids/prism/p07-heptagonal-prism.txt - 3D object coordinates
- solids/prism/p08-octagonal-prism.txt - 3D object coordinates
- solids/prism/p09-enneagonal-prism.txt - 3D object coordinates
- solids/prism/p10-decagonal-prism.txt - 3D object coordinates
- solids/trapezohedron/t04-tetragonal-trapezohedron.txt - 3D object coordinates
- solids/trapezohedron/t05-pentagonal-trapezohedron.txt - 3D object coordinates
- solids/trapezohedron/t06-hexagonal-trapezohedron.txt - 3D object coordinates
- solids/trapezohedron/t08-octagonal-trapezohedron.txt - 3D object coordinates
- solids/trapezohedron/t10-decagonal-trapezohedron.txt - 3D object coordinates
Secondary files
- 2013_endoh4.tar.bz2 - download entry tarball
- README.md - markdown source for this web page
- .entry.json - entry summary and manifest in JSON
- .gitignore - list of files that should not be committed under git
- .path - directory path from top level directory
- index.html - this web page