Add alt code to 2005/persano + format/typo checks

The alt code should (though untested) work in Windows which
distinguishes between text and binary. It uses the Windows functions
_fileno() and _setmode() to set binary mode on stdout.

The README.md file has been format/typo checked.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-22 07:03:46 -08:00
1 parent a42fc7e12a
commit cefc45f635
4 files changed
+192 -3

No files matched your search

+37 -1
View File
@@ -4,6 +4,9 @@
make
```
There is an alternate version of this entry which should work for Windows by
setting binary mode on `stdout`. See [alternate code](#alternate-code) below.
## To use:
@@ -25,6 +28,34 @@ manipulate animated GIFs - to slow down the animation and to compress the GIFs
generated by the entry).
## Alternate code:
This (untested as we have no Windows system) version uses the Windows API
functions `_setmode()` and `_fileno(3)` to set binary mode on `stdout` which should
let it work with Windows.
### Alternate build:
```
make alt
```
### Alternate use:
Use `persano.alt` as you would `persano` above.
### Alternate try:
```sh
./persano.alt 3 16 > knot3-16.gif
```
Follow the same instructions, using different tools if necessary, as the above
try section.
## Judges' remarks:
If your system is one of those that distinguish between text and binary
@@ -52,9 +83,10 @@ knots](https://en.wikipedia.org/wiki/Torus_knot) to standard output.
./persano p q [num frames]
```
### DESCRIPTION
A (p,q)-[torus knot](https://en.wikipedia.org/wiki/Torus_knot) is a closed,
A `(p,q)`-[torus knot](https://en.wikipedia.org/wiki/Torus_knot) is a closed,
non-intersecting curve on the surface of a
[torus](https://en.wikipedia.org/wiki/Torus) in R3 that winds `p` times around
one cycle of the torus and `q` times around the other. `p` and `q` should be
@@ -83,6 +115,7 @@ output; since the number of frames is not specified, an animation with
Please view the code with 8-character tabs!
### OUTPUT FORMAT
The program writes fully valid GIF 89 streams.
@@ -98,6 +131,7 @@ to GIF overhead.
The GIF format supports only a limited number of bits per pixel, so the
program uses ordered dithering to emulate full RGB output.
### PORTABILITY
The program was tested on Linux, with gcc 3.1; Cygwin, with gcc 3.3; and
@@ -109,6 +143,7 @@ It should also be mentioned that the program won't work on systems that
distinguish between text and binary streams; however, since hardly
anyone uses such systems in this day and age, this is a minor issue. [4]
### EXERCISES FOR THE READER
1. (1 point) The surface is composed of many small polygons. Try to make it
@@ -119,6 +154,7 @@ smoother by increasing the number of polygons.
3. (5 points) Locate the famous transcendental constant
[π](https://en.wikipedia.org/wiki/Pi) in the code.
### FOOTNOTES
[1] You can call such a transformation an "ambient isotopy" if you want to