Files
ioccc/2013/endoh4
Landon Curt Noll f29b37e49a improve HTML menus, add social.html, prep for IOCCC28 winners
Prepare for the winners of **IOCCC28**.

> However these are not the 2024 droids you are looking for.  :-)

The HTML menu (both JavaScript and non-JavaScript) has been updated.

The `Status -> Rules and guidelines' have been replaced with two
separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`.

Added a new top level `social.html` page: built from a new `social.md`.

Sorted rules for building specific web pages in the top level `Makefile`.
Added `make social` to make the `social.html` page from `social.md`.

The `bin/gen-top-html.sh` now is able to process a argument of **social**
to process the new top level `social.html` page.

Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13"
to "2.0.1 2025-07-25".

Below `About -> Home page` a new `About -> IOCCC social media` menu item
as added.

Because the menu change touched every HTML file, we changed the general
copyright date range for HTML files from "1984-2024" to "1984-2025"
due to the extensive changes made for **IOCCC28**.

Those markdown files that were modified in 2025 had their copyright date
range also changed from "1984-2024" to "1984-2025".

Rebuilt tarballs and sitemap due to the extensive HTML rebuilding.

Ran `make update` to perform the above.
2025-07-26 13:06:29 -07:00
..
2020-12-30 16:57:03 -08:00
2020-12-30 16:57:03 -08:00
2023-07-06 21:49:38 -07:00
2024-06-01 11:38:45 -07:00

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:

  1. reads three-dimensional vertices (3N float values) from stdin,
  2. calculates a convex hull of them, and
  3. 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".