Merge pull request #1030 from xexyl/2013-endoh4

Format and typo fix 2013/endoh4/README.md
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-10-12 07:46:17 -07:00
commit da6fb4e498
4 files changed
+71 -27

No files matched your search

+1
View File
@@ -25,6 +25,7 @@ make
./dlowe 16 32 64 128 256 ./dlowe 16 32 64 128 256
./dlowe 16 32 64 128 256 512 ./dlowe 16 32 64 128 256 512
./dlowe 0 ./dlowe 0
echo "sparkline of file sizes: $(wc -c * | awk '{print $1}' | xargs ./dlowe)" # or ./slen.sh echo "sparkline of file sizes: $(wc -c * | awk '{print $1}' | xargs ./dlowe)" # or ./slen.sh
+39 -27
View File
@@ -14,28 +14,35 @@ make
## To run: ## To run:
```sh ```sh
./endoh4 ./endoh4 < file
./run.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 `run.sh` command line
it will feed to the program [endoh4.c](endoh4.c).
## Try: ## Try:
```sh ```sh
./endoh4 < cube.txt ./run.sh cube.txt
``` ```
Hit ctrl-c to end the program.
The author recommends the use of xterm. The author recommends the use of xterm.
For example, if you are a soccer fan, try: For an example, if you are a football/soccer fan, try:
```sh ```sh
./endoh4 < solids/archimedian-solid/a11-truncated-icosahedron.txt ./run.sh solids/archimedian-solid/a11-truncated-icosahedron.txt
``` ```
## Judges' remarks: ## Judges' remarks:
This program is formatted as the net for a tetrahedron. (hint, try feeding the 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 program it's own source code like `./run.sh`). When it runs there is an
computation to work out the convex hull. animation for the computation to work out the convex hull.
## Author's remarks: ## Author's remarks:
@@ -43,7 +50,7 @@ computation to work out the convex hull.
This is a convex polyhedron viewer, which: This is a convex polyhedron viewer, which:
1. reads three-dimentional vertices (3N float values) from stdin, 1. reads three-dimensional vertices (3N float values) from `stdin`,
2. calculates a convex hull of them, and 2. calculates a convex hull of them, and
3. renders it. 3. renders it.
@@ -51,8 +58,8 @@ This simple spec involves many details.
* 3D convex hull calculation * 3D convex hull calculation
* recursive gift wrapping algorithm * recursive gift wrapping algorithm
* automatical merging of (almost) co-planar faces * automatic merging of (almost) co-planar faces (i.e., faces are not
(i.e., faces are not triangulated) triangulated)
* random perturbation for robustness * random perturbation for robustness
* 3D rendering * 3D rendering
* perspective projection * perspective projection
@@ -63,13 +70,12 @@ This simple spec involves many details.
### Portability ### Portability
I think it conforms with both C89 and C99. I think it conforms with both C89 and C99. I confirmed that it worked on gcc,
I confirmed that it worked on gcc, clang, and tcc. clang, and tcc. It should not be warned with `-pedantic` and `-Wextra`.
It should not be warned with -pedantic and -Wextra.
### Tips ### Tips
You may want to use `tput` to hide a terminal cursor. You may want to use `tput` to hide the terminal cursor.
```sh ```sh
tput civis tput civis
@@ -77,6 +83,12 @@ tput civis
tput cnorm tput cnorm
``` ```
or
```sh
./run.sh cube.txt
```
### Bonuses ### Bonuses
You can change the screen size. Let the aspect ratio be about 3:1. You can change the screen size. Let the aspect ratio be about 3:1.
@@ -89,24 +101,24 @@ The shape of this code is the geometric net of a regular tetrahedron.
So, try: So, try:
```sh ```sh
./endoh4 < endoh4.c ./endoh4 < endoh4.c # or ./run.sh
``` ```
The solids.tbz2 file includes various solid data: The [solids/](solids/) directory includes various solid data:
[Platonic solids](http://en.wikipedia.org/wiki/Platonic_solid),
[Archimedean solids](http://en.wikipedia.org/wiki/Archimedean_solid), - [Platonic solids](http://en.wikipedia.org/wiki/Platonic_solid)
[Prisms](http://en.wikipedia.org/wiki/Prism_%28geometry%29), - [Archimedean solids](http://en.wikipedia.org/wiki/Archimedean_solid)
[Antiprisms](http://en.wikipedia.org/wiki/Antiprism), - [Prisms](http://en.wikipedia.org/wiki/Prism_%28geometry%29)
[Bipyramids](http://en.wikipedia.org/wiki/Bipyramid), - [Antiprisms](http://en.wikipedia.org/wiki/Antiprism)
[Trapezohedrons](http://en.wikipedia.org/wiki/Trapezohedron), and - [Bipyramids](http://en.wikipedia.org/wiki/Bipyramid)
[Johnson solids](http://en.wikipedia.org/wiki/Johnson_solid). - [Trapezohedrons](http://en.wikipedia.org/wiki/Trapezohedron)
- [Johnson solids](http://en.wikipedia.org/wiki/Johnson_solid)
I created the files by using the POV-Ray scripts I created the files by using the POV-Ray scripts
([1](http://en.wikipedia.org/wiki/File:Poly.pov) and ([1](http://en.wikipedia.org/wiki/File:Poly.pov) and
[2](http://en.wikipedia.org/wiki/User:AndrewKepert/poly.pov)) [2](http://en.wikipedia.org/wiki/User:AndrewKepert/poly.pov)) in Wikipedia.
in Wikipedia. They are copyrighted in CC BY-SA 3.0 by "User:Cyp" and "User:AndrewKepert".
They are copyrighted in CC BY-SA 3.0
by "User:Cyp" and "User:AndrewKepert".
## Copyright and CC BY-SA 4.0 License: ## Copyright and CC BY-SA 4.0 License:
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
make all || exit 1
# set it so that when program is terminated through various signals we re-enable
# the cursor
trap "tput cnorm;echo" 0 1 2 3 15
# temporarily disable cursor
tput civis
# run program attempting to feed it a file, if specified
if [[ "$#" -eq 1 ]]; then
./endoh4 < "$1"
else
# otherwise feed the source code of the program to the program
./endoh4 < endoh4.c
fi
# explicitly set cursor back just in case it's not terminated through one of the
# above signals
tput cnorm
+9
View File
@@ -1630,6 +1630,15 @@ Cody also added the [demo.sh](2013/dlowe/demo.sh) script to more easily try the
program. program.
## [2013/endoh4](2013/endoh4/endoh4.c) ([README.md](2013/endoh4/README.md))
Cody added the [run.sh](2013/endoh4/run.sh) script which temporarily turns off
the cursor as suggested by the author, with the addition that if no file is
specified it will feed the source code [endoh4.c](2013/endoh4/endoh4.c) to the
program rather than the file specified. It does not try and detect if the file
exists or can be read as that will be handled by the shell/program.
## [2013/hou](2013/hou/hou.c) ([README.md](2013/hou/README.md)) ## [2013/hou](2013/hou/hou.c) ([README.md](2013/hou/README.md))
After the file 2013/hou/doc/example.markdown was moved to After the file 2013/hou/doc/example.markdown was moved to