author Dmitriy Morozov Thu Jun 07 21:21:11 2012 -0700 (2012-06-07) branch dev changeset 264 55700750a464 parent 263 185923889ab4 child 265 66a311c0d597
Points at infinity in DiagramViewer
```     1.1 --- a/bindings/python/dionysus/viewer/diagram.py	Thu Jun 07 21:16:06 2012 -0700
1.2 +++ b/bindings/python/dionysus/viewer/diagram.py	Thu Jun 07 21:21:11 2012 -0700
1.3 @@ -2,11 +2,13 @@
1.4  from    math        import fabs
1.5
1.6  class DiagramPoint(QtGui.QGraphicsEllipseItem):
1.7 -    def __init__(self,x,y, p):
1.8 +    def __init__(self,x,y, p, infty = False):
1.9          super(QtGui.QGraphicsEllipseItem, self).__init__()
1.10          self.setPen(QtGui.QPen(QtGui.QColor(225, 0, 0)))
1.11          self.setBrush(QtGui.QBrush(QtCore.Qt.red))
1.13 +        if infty:
1.15          self.x, self.y = x,y
1.16          self.scale(1)
1.17          self.p = p
1.18 @@ -42,10 +44,16 @@
1.19
1.20          for p in dgm:
1.21              x,y = p[0],p[1]
1.22 -            if x == inf or y == inf: continue
1.23              if fabs(y - x) < noise:
1.24                  continue
1.25 -            item = DiagramPoint(x,y,p)
1.26 +            if fabs(x) == inf or fabs(y) == inf:
1.27 +                if x == inf: x = maxx + 2
1.28 +                if y == inf: y = maxy + 2
1.29 +                if x == -inf: x = minx - 2
1.30 +                if y == -inf: y = miny - 2
1.31 +                item = DiagramPoint(x,y,p, infty = True)
1.32 +            else:
1.33 +                item = DiagramPoint(x,y,p)