Correct bad arrow enpoint when parallel edges are enabled.
1.1 --- a/src/lemon/graph_to_eps.h Tue Jan 18 12:02:27 2005 +0000
1.2 +++ b/src/lemon/graph_to_eps.h Tue Jan 18 12:23:09 2005 +0000
1.3 @@ -153,6 +153,8 @@
1.4 typedef typename Graph::InEdgeIt InEdgeIt;
1.5 typedef typename Graph::OutEdgeIt OutEdgeIt;
1.6
1.7 + static const int INTERPOL_PREC=20;
1.8 +
1.9 bool dontPrint;
1.10
1.11 enum NodeShapes { CIRCLE=0, SQUARE=1 };
1.12 @@ -517,21 +519,20 @@
1.13 xy<double> mm=m+rot(d)*sw/.75;
1.14 if(_drawArrows) {
1.15 int node_shape;
1.16 - const int INERPOL_PREC=20;
1.17 xy<double> s=_coords[g.source(*e)];
1.18 xy<double> t=_coords[g.target(*e)];
1.19 double rn=_nodeSizes[g.target(*e)]*_nodeScale;
1.20 node_shape=_nodeShapes[g.target(*e)];
1.21 Bezier3 bez(s,mm,mm,t);
1.22 double t1=0,t2=1;
1.23 - for(int i=0;i<INERPOL_PREC;++i)
1.24 + for(int i=0;i<INTERPOL_PREC;++i)
1.25 if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
1.26 else t1=(t1+t2)/2;
1.27 xy<double> apoint=bez((t1+t2)/2);
1.28 rn = _arrowLength+_edgeWidths[*e]*_edgeWidthScale;
1.29 rn*=rn;
1.30 t2=(t1+t2)/2;t1=0;
1.31 - for(int i=0;i<INERPOL_PREC;++i)
1.32 + for(int i=0;i<INTERPOL_PREC;++i)
1.33 if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
1.34 else t2=(t1+t2)/2;
1.35 xy<double> linend=bez((t1+t2)/2);
1.36 @@ -539,7 +540,7 @@
1.37 // rn=_nodeSizes[g.source(*e)]*_nodeScale;
1.38 // node_shape=_nodeShapes[g.source(*e)];
1.39 // t1=0;t2=1;
1.40 -// for(int i=0;i<INERPOL_PREC;++i)
1.41 +// for(int i=0;i<INTERPOL_PREC;++i)
1.42 // if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t1=(t1+t2)/2;
1.43 // else t2=(t1+t2)/2;
1.44 // bez=bez.after((t1+t2)/2);
1.45 @@ -577,15 +578,20 @@
1.46 if(!_undir||g.source(e)<g.target(e))
1.47 if(_drawArrows) {
1.48 xy<double> d(_coords[g.target(e)]-_coords[g.source(e)]);
1.49 + double rn=_nodeSizes[g.target(e)]*_nodeScale;
1.50 + int node_shape=_nodeShapes[g.target(e)];
1.51 + double t1=0,t2=1;
1.52 + for(int i=0;i<INTERPOL_PREC;++i)
1.53 + if(isInsideNode((-(t1+t2)/2)*d,rn,node_shape)) t1=(t1+t2)/2;
1.54 + else t2=(t1+t2)/2;
1.55 double l=sqrt(d.normSquare());
1.56 d/=l;
1.57 - xy<double> x1(d*_nodeScale*_nodeSizes[g.source(e)]+
1.58 - _coords[g.source(e)]);
1.59 - os << l-(_nodeSizes[g.source(e)]+
1.60 - _nodeSizes[g.target(e)])*_nodeScale << ' '
1.61 +
1.62 + os << l*(1-(t1+t2)/2) << ' '
1.63 << _edgeWidths[e]*_edgeWidthScale << ' '
1.64 << d.x << ' ' << d.y << ' '
1.65 - << x1.x << ' ' << x1.y << ' '
1.66 + << _coords[g.source(e)].x << ' '
1.67 + << _coords[g.source(e)].y << ' '
1.68 << _edgeColors[e].getR() << ' '
1.69 << _edgeColors[e].getG() << ' '
1.70 << _edgeColors[e].getB() << " arr\n";