The split edges created during the insertion of a new node are now joined at the end.
The split edges created during the insertion of a new node are now joined at the end.

file:a/voronoi.py -> file:b/voronoi.py
--- a/voronoi.py
+++ b/voronoi.py
@@ -29,8 +29,9 @@
         print '((%f-x)**2-%f**2+%f**2)/(2(%f-%f))'%(self.point[0],ypp,self.point[1],self.point[1], ypp)
 
 class Edge:
-    def __init__(self,start,lp,rp):
-        self.start=start
+    def __init__(self,r,lp,rp):
+        self.r=r
+        self.start=0
         self.end=None
         self.lp=lp
         self.rp=rp
@@ -44,14 +45,14 @@
         return (self.value_x(t),self.value_y(t))
 
     def value_x(self,t):
-        return self.direction[0]*t+self.start[0]
+        return self.direction[0]*t+self.r[0]
 
     def value_y(self,t):
-        return self.direction[1]*t+self.start[1]
+        return self.direction[1]*t+self.r[1]
 
     def intersects_with(self,edge):
-        x=self.start[0]-edge.start[0]
-        y=self.start[1]-edge.start[1]
+        x=self.r[0]-edge.r[0]
+        y=self.r[1]-edge.r[1]
         
         a=-self.direction[0]
         b=edge.direction[0]
@@ -74,12 +75,12 @@
         # Intersection with north and south edges (horizontal)
         if self.direction[1]!=0:
             # North (y=height)
-            t=(height-self.start[1])/self.direction[1]
+            t=(height-self.r[1])/self.direction[1]
             x=self.value_x(t)
             if 0<x and x<width:
                 intersections.append(t)
             # South (y=0)
-            t=-self.start[1]/self.direction[1]
+            t=-self.r[1]/self.direction[1]
             x=self.value_x(t)
             if 0<x and x<width:
                 intersections.append(t)
@@ -87,12 +88,12 @@
         # Intersections with east and west (vertical)
         if self.direction[0]!=0:
             # East (x=height)
-            t=(width-self.start[0])/self.direction[0]
+            t=(width-self.r[0])/self.direction[0]
             y=self.value_y(t)
             if 0<y and y<height:
                 intersections.append(t)
             # West (x=0)
-            t=-self.start[0]/self.direction[0]
+            t=-self.r[0]/self.direction[0]
             y=self.value_y(t)
             if 0<y and y<height:
                 intersections.append(t)
@@ -105,10 +106,13 @@
         maxt=max(intersections)
 
         # Determine what range of values the line defined as now takes
+        if self.start==None: # Make sure to clip the edge if it is infinite
+            self.start=mint # This is when the box is left
+
         if self.end==None: # Make sure to clip the edge if it is infinite
             self.end=maxt # This is when the box is left
 
-        p1t=0
+        p1t=self.start
         p2t=self.end
 
         if p2t<mint or p1t>maxt: # This edge lies outside of the box
@@ -250,7 +254,7 @@
             label='%s\\n(%.1f,%.1f)'%(self,self.parabola.point[0],self.parabola.point[1])
             fh.write('\t%s [label="%s"];\n'%(name,label))
         else:
-            label='%s\\np (%.1f,%.1f)\\nd (%.1f,%.1f)'%(self,self.edge.start[0],self.edge.start[1],self.edge.direction[0],self.edge.direction[1])
+            label='%s\\np (%.1f,%.1f)\\nd (%.1f,%.1f)'%(self,self.edge.r[0],self.edge.r[1],self.edge.direction[0],self.edge.direction[1])
             fh.write('\t%s [label="%s"];\n'%(name,label))
 
             self.left.dump_node(fh,name+'l')
@@ -344,8 +348,7 @@
 
         edge1=Edge(intersection,node.parabola.point,parabola.point)
         edge2=Edge(intersection,parabola.point,node.parabola.point)
-        self.internal_edges.append(edge1)
-        self.internal_edges.append(edge2)
+        self.internal_edges.append((edge1,edge2))
 
         edge_node2=Node()
         edge_node2.set_left(newnode)
@@ -426,6 +429,14 @@
     def finish_edges(self):
         edges=[]
         for edge in self.internal_edges:
+            if type(edge)==tuple:
+                tmpedges=edge
+                edge=tmpedges[0]
+                if tmpedges[1].end==None:
+                    edge.start=None
+                else:
+                    edge.start=-tmpedges[1].end
+
             trim=edge.img_coords(self.width,self.height)
             if trim!=None:
                 edges.append(trim)