Added a tolerance level to account for round-off errors when computing intersection of two lines. Right now it is set to epsilon as default.
Added a tolerance level to account for round-off errors when computing intersection of two lines. Right now it is set to epsilon as default.

--- a/voronoi/fortune.py
+++ b/voronoi/fortune.py
@@ -262,6 +262,8 @@
         self.width=width
         self.height=height
 
+        self.tolerance=sys.float_info.epsilon
+
         # Results are stored here
         self.edges=[]
         self.sites={}
@@ -387,11 +389,10 @@
         edge_to_end2=circle_node.first_right_parent().edge
         t,s=edge_to_end1.intersects_with(edge_to_end2)
         
-#        print 't,s',t,s
-        if (t<0 and edge_to_end1.start!=None) or (s<0 and edge_to_end2.start!=None):
+        print 't,s',t,s
+        if (t<-self.tolerance and edge_to_end1.start!=None) or (s<-self.tolerance and edge_to_end2.start!=None):
             return
-
-        if t==s and t==0:
+        if t==s and abs(t)<self.tolerance:
             return
 
         center=edge_to_end1.value(t)
@@ -473,7 +474,7 @@
                     first_edge=edge
                     break
 
-			# Step 3: Find subsequent edges
+            # Step 3: Find subsequent edges
             self.sites[site]=[first_edge]
             new_edges.remove(first_edge)
             last_end=first_edge.value(first_edge.end)
@@ -485,10 +486,6 @@
                         new_edges.remove(edge)
                         self.sites[site].append(edge)
                         break
-
-
-
-            new_sites[site]=new_edges
             
  
     def remove_event(self,event):