Fix a bug that caused corrupt eps file if there are loops or identical
authoralpar
Fri, 15 Apr 2005 20:26:01 +0000
changeset 13604338e4280f67
parent 1359 1581f961cfaa
child 1361 04733359bac2
Fix a bug that caused corrupt eps file if there are loops or identical
node coordinates in the graph.
src/lemon/graph_to_eps.h
     1.1 --- a/src/lemon/graph_to_eps.h	Fri Apr 15 19:56:25 2005 +0000
     1.2 +++ b/src/lemon/graph_to_eps.h	Fri Apr 15 20:26:01 2005 +0000
     1.3 @@ -809,8 +809,9 @@
     1.4  	  sw-=_parEdgeDist;
     1.5  	  sw/=-2.0;
     1.6  	  xy<double> dvec(_coords[g.target(*i)]-_coords[g.source(*i)]);
     1.7 -	  double l=sqrt(dvec.normSquare());
     1.8 -	  xy<double> d(dvec/l);
     1.9 +	  double l=sqrt(dvec.normSquare()); 
    1.10 +	  ///\todo better 'epsilon' would be nice here.
    1.11 +	  xy<double> d(dvec/max(l,1e-9));
    1.12   	  xy<double> m;
    1.13  // 	  m=xy<double>(_coords[g.target(*i)]+_coords[g.source(*i)])/2.0;
    1.14