simon-git: polyhedra (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Mon Jul 8 19:19:21 BST 2019
TL;DR:
136fbc3 Migrate all these programs to use Python 'argparse'.
64fb3a6 mkpoints.py: tidy up progress messages.
bba236c cleanpoly.py: clean harder.
f59ab63 canvas.py: provide an HTML output mode.
2c24635 mkpoints.py: add a projective mode.
8bdb8fe New script to construct zonohedra.
Repository: https://git.tartarus.org/simon/polyhedra.git
On the web: https://git.tartarus.org/?p=simon/polyhedra.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2019-07-08 19:19:21
commit 136fbc3731d40e6cd7a287391cfeef0a04f61c00
web diff https://git.tartarus.org/?p=simon/polyhedra.git;a=commitdiff;h=136fbc3731d40e6cd7a287391cfeef0a04f61c00;hp=99cc469a719677ce08d4f32535782dad5fc1ae63
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Jul 8 19:01:38 2019 +0100
Migrate all these programs to use Python 'argparse'.
It's my normal preference over getopt or manual argv-herding these
days, partly because it's reasonably easy to add extra options, but
mostly because it comes with --help built in, so every time I come
back to this suite of programs after a few years' absence, I'll
actually be able to remember how to use them without having to
source-dive.
canvas.py | 28 +++----
cleanpoly.py | 45 +++++------
describe.py | 38 ++++-----
drawnet.py | 222 ++++++++++++++++++++++++---------------------------
drawpoints.py | 42 +++++-----
drawpoly.py | 63 ++++++---------
dual.py | 38 ++++-----
flashpoly.py | 37 ++++-----
isometry.py | 56 +++++--------
mkpoints.py | 41 ++++------
nfaces.py | 69 +++++++---------
nvertices.py | 39 ++++-----
povpoly.py | 117 ++++++++++++---------------
regular/mkregular.py | 39 ++++-----
untangle.py | 30 +++----
15 files changed, 393 insertions(+), 511 deletions(-)
commit 64fb3a6d3bd369fccfefeb96b2146eb8b8093b73
web diff https://git.tartarus.org/?p=simon/polyhedra.git;a=commitdiff;h=64fb3a6d3bd369fccfefeb96b2146eb8b8093b73;hp=136fbc3731d40e6cd7a287391cfeef0a04f61c00
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Jul 8 19:02:46 2019 +0100
mkpoints.py: tidy up progress messages.
Now each message overwrites the previous one, and also, we don't
print them at all unless stderr is a terminal.
mkpoints.py | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
commit bba236c7808252f45154f2c7a01a0aaec99a60e8
web diff https://git.tartarus.org/?p=simon/polyhedra.git;a=commitdiff;h=bba236c7808252f45154f2c7a01a0aaec99a60e8;hp=64fb3a6d3bd369fccfefeb96b2146eb8b8093b73
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Jul 8 19:03:06 2019 +0100
cleanpoly.py: clean harder.
The previous strategy was fine for merging two triangles across a
common edge, but I had occasion to make it merge three or more
coplanar around a central vertex, and it wasn't able to remove the
last edge to that vertex and delete it. Now it can do that extra level
of tidying.
cleanpoly.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
commit f59ab63d0a1141285078b06bb9a9d25a5f698f44
web diff https://git.tartarus.org/?p=simon/polyhedra.git;a=commitdiff;h=f59ab63d0a1141285078b06bb9a9d25a5f698f44;hp=bba236c7808252f45154f2c7a01a0aaec99a60e8
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Jul 8 19:04:06 2019 +0100
canvas.py: provide an HTML output mode.
In this mode, instead of writing out just the raw JSON polyhedron data
for embedding into an existing web page, we output a self-contained
HTML document. Useful for initial testing and previewing.
canvas.py | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
commit 2c2463509671d7b0df3a12bf7dfdcb7d35ec7e96
web diff https://git.tartarus.org/?p=simon/polyhedra.git;a=commitdiff;h=2c2463509671d7b0df3a12bf7dfdcb7d35ec7e96;hp=f59ab63d0a1141285078b06bb9a9d25a5f698f44
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Jul 8 19:08:09 2019 +0100
mkpoints.py: add a projective mode.
In this mode, opposite points on the unit sphere are identified with
each other, by means of pretending each point's antipode is also
exerting repelling force. Then at output time we can either print one
element of each pair, or both.
Printing both allows us to find widely-spaced point sets under the
constraint that they're symmetric in central inversion; for example,
where 8 unconstrained points buckled into a square antiprism instead
of giving the vertices of a cube, 8 points under this constraint (or
rather, 4 points plus their antipodes) do give a cube.
Printing just one of each opposite pair is about to be useful for the
script I'm going to add in the next commit.
mkpoints.py | 45 ++++++++++++++++++++++++++++++++-------------
1 file changed, 32 insertions(+), 13 deletions(-)
commit 8bdb8fe12a3396bf3ad88f828ef76faacf66c661
web diff https://git.tartarus.org/?p=simon/polyhedra.git;a=commitdiff;h=8bdb8fe12a3396bf3ad88f828ef76faacf66c661;hp=2c2463509671d7b0df3a12bf7dfdcb7d35ec7e96
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Jul 8 19:10:28 2019 +0100
New script to construct zonohedra.
A zonohedron is a convex polyhedron in which every face has twofold
rotational symmetry, so that every edge has a parallel opposite edge
on the far side of each face. This means that the edges come in
equivalence classes all with the same length and direction (just start
from any edge and keep jumping to the one opposite it on one of the
neighbouring faces), and contracting all those edges to points
generates a smaller solid with the same property, which inductively
proves that the solid is actually _generated_ by its set of distinct
edge vectors. Specifically, given a set of vectors, compute its power
set; for each element of the power set, sum the vectors in it; then
the convex hull of those 2^n points is the zonohedron.
This tool generates one starting from a set of edge vectors. Because
it's pointless to have two edge vectors be parallel, it's useful to
use the projective mode of mkpoints.py without the --both option, to
generate a good set of vectors as input to this tool.
Unfortunately, it's beyond my usual level of numerical bodginess: if
you give it a set of edge vectors that are too close to coplanar, or
which have some nontrivial relation between them (e.g. the vectors
from the centre to each vertex of an icosahedron), then it goes off
the rails. To work around this I've added an option to perturb the
input points just enough to avoid the problem, after which
cleanpoly.py can clear up the mess. Horrible, but it works.
zonohedron.py | 255 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 255 insertions(+)
More information about the tartarus-commits
mailing list