From 2c669de47805cf0b8bd1c8bcf3958f52b1902926 Mon Sep 17 00:00:00 2001
From: Vivien Maisonneuve <v.maisonneuve@gmail.com>
Date: Sat, 12 Jul 2014 09:57:20 +0200
Subject: [PATCH] Implement method Polyhedron.faces()

---
 pypol/polyhedra.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pypol/polyhedra.py b/pypol/polyhedra.py
index 5d9c287..37f16e0 100644
--- a/pypol/polyhedra.py
+++ b/pypol/polyhedra.py
@@ -242,6 +242,17 @@ class Polyhedron(Domain):
             angles[m] = angle
         return sorted(points, key=angles.get)
 
+    def faces(self):
+        vertices = self.vertices()
+        faces = []
+        for constraint in self.constraints:
+            face = []
+            for vertex in vertices:
+                if constraint.subs(vertex.coordinates()) == 0:
+                    face.append(vertex)
+            faces.append(face)
+        return faces
+
     def plot(self):
         import matplotlib.pyplot as plt
         from matplotlib.path import Path
-- 
2.20.1