From 7c6b2612e47086563cd58ae57c13a7a1beca03b8 Mon Sep 17 00:00:00 2001 From: Vivien Maisonneuve Date: Sun, 13 Jul 2014 16:07:45 +0200 Subject: [PATCH] Add tesseract example --- examples/tesseract.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 examples/tesseract.py diff --git a/examples/tesseract.py b/examples/tesseract.py new file mode 100755 index 0000000..b2a5e97 --- /dev/null +++ b/examples/tesseract.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +from pypol import * + +x, y, z, t = symbols('x y z t') + +tesseract = \ + Le(0, x) & Le(x, 1) & \ + Le(0, y) & Le(y, 1) & \ + Le(0, z) & Le(z, 1) & \ + Le(0, t) & Le(t, 1) + +def faces(polyhedron): + for points in polyhedron.faces(): + face = points[0].aspolyhedron() + face = face.union(*[point.aspolyhedron() for point in points[1:]]) + face = face.aspolyhedron() + yield face + +print('Faces of tesseract\n\n {}\n\nare:\n'.format(tesseract)) +for face in faces(tesseract): + assert(len(face.vertices()) == 8) + print(' {}'.format(face)) -- 2.20.1