add documentation

This commit is contained in:
Florian Stecker 2023-01-17 07:15:44 -05:00
parent c62044d637
commit ae48012a6e
3 changed files with 65 additions and 16 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.o
hyperbolic
output/
README.html

49
README.md Normal file
View File

@ -0,0 +1,49 @@
# hyperbolic tilings #
A program to draw regular tilings of the hyperbolic plane by triangles as SVG files.
## Setup ##
GCC and GNU make are needed. To compile, just run `make`.
## Usage ##
The executable is called `hyperbolic` and is invoked as follows:
$ ./hyperbolic
Usage: ./hyperbolic <p> <q> <r> <n_elements> <word1> <word2> ...
The arguments `p,q,r` specify the orders of the rotations `bc`, `ca` and `ab`, where `a,b,c` are the reflections along the three sides of the triangle. The parameter `n_elements` limits how many translates of the triangle are being drawn (1000 is a good default value, although for some values of `p,q,r` more are needed).
The program can not only draw the tiling by triangles, but also the axes of specific hyperbolic elements in the triangle group or the fixed points of elliptic elements. To use this feature, just specify the group elements as additional arguments, written as words in the three reflections `a,b,c`. This will draw its axis/fixed point and that of all of its conjugates.
## Examples ##
./hyperbolic 5 5 5 5000 abc
![(5,5,5) tiling with axes of abc and its conjugates](https://florianstecker.net/git_files/hyperbolic_tilings/tiling_555_abc.png)
./hyperbolic 2 3 7 20000
![(2,3,7) tiling](https://florianstecker.net/git_files/hyperbolic_tilings/tiling_237.png)
./hyperbolic 2 3 7 20000 ab
![(2,3,7) tiling](https://florianstecker.net/git_files/hyperbolic_tilings/tiling_237_ab.png)
## Conversion to PDF or PNG ##
If a different image format is required, the SVG files can easily be converted. Using [rsvg-convert] gives good results
To convert to PNG (used for the images above):
rsvg-convert --format=png -w 600 -h 600 tiling_555_abc.svg -o tiling_555_abc.png
To convert to PDF:
rsvg-convert --format=pdf -w tiling_555_abc.svg -o tiling_555_abc.pdf
`maketiling.sh` is a convenience script which takes the same arguments as `hyperbolic`, but saves the SVG file in the folder `output/` (which has to be present) with a descriptive name and also converts it to PDF.
[rsvg-convert]: https://gitlab.gnome.org/GNOME/librsvg

View File

@ -291,24 +291,23 @@ int main(int argc, const char *argv[])
nspecial_hyp = nspecial_rot = 0;
for(int i = 0; i < nspecial; i++) {
LOOP(j) {
int nreal;
int j = 0;
int nreal;
compute_word(ws, special[3*i+j], gen, argv[i+5], j, 0);
nreal = eigenvectors(special[3*i+j], special_eigenvectors[3*i+j], ws);
if(nreal == 3) {
special_attracting[nspecial_hyp] = column(special_eigenvectors[3*i+j], 0);
compute_word(ws, special[3*i+j], gen, argv[i+5], j, 0);
nreal = eigenvectors(special[3*i+j], special_eigenvectors[3*i+j], ws);
if(nreal == 3) {
special_attracting[nspecial_hyp] = column(special_eigenvectors[3*i+j], 0);
// repelling = attracting of inverse
compute_word(ws, special[3*i+j], gen, argv[i+5], j, 1);
eigenvectors(special[3*i+j], special_eigenvectors[3*i+j], ws);
special_repelling[nspecial_hyp] = column(special_eigenvectors[3*i+j], 0);
nspecial_hyp++;
} else {
special_rotation[nspecial_rot] = column(special_eigenvectors[3*i+j], 0);
nspecial_rot++;
}
}
// repelling = attracting of inverse
compute_word(ws, special[3*i+j], gen, argv[i+5], j, 1);
eigenvectors(special[3*i+j], special_eigenvectors[3*i+j], ws);
special_repelling[nspecial_hyp] = column(special_eigenvectors[3*i+j], 0);
nspecial_hyp++;
} else {
special_rotation[nspecial_rot] = column(special_eigenvectors[3*i+j], 0);
nspecial_rot++;
}
}
fprintf(stderr, "%d special elements, %d rotations, %d hyperbolic\n", nspecial, nspecial_rot, nspecial_hyp);