]> granicus.if.org Git - graphviz/commitdiff
fix an arithmetic instability
authorellson <devnull@localhost>
Tue, 3 Oct 2006 19:15:51 +0000 (19:15 +0000)
committerellson <devnull@localhost>
Tue, 3 Oct 2006 19:15:51 +0000 (19:15 +0000)
lib/common/geom.c

index 852f7f2279c0d0b9b0b2a26ea93c8a67de580ef6..0c4bb3b059b4811ff020ba9abb1d09b429be150a 100644 (file)
@@ -527,5 +527,6 @@ double ptToLine2 (pointf a, pointf b, pointf p)
   double dx = b.x-a.x;
   double dy = b.y-a.y;
   double a2 = (p.y-a.y)*dx - (p.x-a.x)*dy;
+  if (a2 < .00001) return 0.;
   return (a2*a2) / (dx*dx + dy*dy);
 }