This repo contains Python code used to create images for the Wikiversity article
Full octahedral group.
Each image represents one of the 48 permutations in the full octahedral group as a permutation of the cube.
Raytracing is done with POV-Ray. Templating is done with Bottle.
SVG | Raytracing plain | Raytracing subgroup |
- Clone the repo:
clone https://github.com/watchduck/full_octahedral_group.git
- Install a virtual environment in it:
virtualenv env
- Turn it on:
source env/bin/activate
- Install the dependencies:
pip install -r requirements.txt
- Run
python app.py
in each of the project folders - Files will be created in subfolders called FILES.
The lines in the .tpl
files starting with %
(or between <%
and %>
) are Python.
So are parts between {{
and }}
in a line. ({{!
is a variant of {{
.)
Templating is not just used to create SVG files, but also to create Povray scene description files (.pov
).
E.g. in app.py the template plain.tpl is used with t = template('plain', context)
.
The variable transformations
from app.py is included in the template with {{!transformations}}
.
The Povray scene description file generated from the template is delete_me_after_use.pov
. This is rendered as an image with a name like Cube permutation 0 0 JF.png
(see image in the middle above).
A side of the three-dimensional JF compound representing a cube permutation is also shown in each of the SVG files.
The six sides are included (if JF_side ==
...) and permuted ({{manipulation}}
) in JF_perm.tpl. The permutations used for that were generated here and copied to constants.py (JF_sides_and_manipulations
).
JF_cube_sides |
manipulations |
There are different ways to represent the elements of the full octahedral group:
- Pairs
- S4 based identifiers (n' or n+24 for n∘inversion)
- 3×3 signed permutation matrices
- permutations of 8 elements (namely cube vertices)
A bijection between pairs and 3×3 matrices is found here (lin_transform_matrices
).
Bijections between pairs and S4 based identifiers (pairs_to_num_bidict
) as well as pairs and permutations of 8 elements (pairs_to_perm_bidict
) can be found here.
This file also contains a dictionary of all subgroups.