projects
/
linpy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement method Polyhedron.faces()
[linpy.git]
/
pypol
/
polyhedra.py
diff --git
a/pypol/polyhedra.py
b/pypol/polyhedra.py
index
2eaa7b5
..
37f16e0
100644
(file)
--- a/
pypol/polyhedra.py
+++ b/
pypol/polyhedra.py
@@
-1,4
+1,3
@@
-
import functools
import math
import numbers
import functools
import math
import numbers
@@
-6,8
+5,7
@@
import numbers
from . import islhelper
from .islhelper import mainctx, libisl
from . import islhelper
from .islhelper import mainctx, libisl
-from .geometry import GeometricObject
-from .coordinates import Point
+from .geometry import GeometricObject, Point
from .linexprs import Expression, Symbol, Rational
from .domains import Domain
from .linexprs import Expression, Symbol, Rational
from .domains import Domain
@@
-244,6
+242,17
@@
class Polyhedron(Domain):
angles[m] = angle
return sorted(points, key=angles.get)
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
def plot(self):
import matplotlib.pyplot as plt
from matplotlib.path import Path