# Revision history [back]

Hi,

polygon is just a function for plotting. In order to be able to solve your problem you should use Polyhedron as in

sage: P = Polyhedron(vertices=[(0,0),(1.3,2.2),(0.7,1)])
sage: P.plot()


Then you compute a bounding box for your polyhderon

sage: xmin = min(x for x,y in P.vertices_list())
sage: xmax = max(x for x,y in P.vertices_list())
sage: ymin = min(y for x,y in P.vertices_list())
sage: ymax = max(y for x,y in P.vertices_list())


And for each square fundamental domain within your bounding box you compute the intersection of P with the square and store the translates:

sage: L = []
sage: for i in xrange(xmin,xmax+1):
...     for j in xrange(ymin,ymax+1):
...       K = P.intersection(Polyhedron(vertices=[(i,j),(i+1,j),(i+1,j+1),(i,j+1)]))
...       if K.dim() == 2:
...         L.append(K.translation((-i,-j)))


Then you can plot each pieces into a fundamental domain:

sage: n = len(L)
sage: colors = rainbow(n,'rgbtuple')
sage: sum((L[i].plot(color=colors[i]) for i in xrange(n)), Graphics())


Vincent