[Lemon-commits] [lemon_svn] alpar: r1483 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:45:47 CET 2006
Author: alpar
Date: Tue Jan 18 13:23:09 2005
New Revision: 1483
Modified:
hugo/trunk/src/lemon/graph_to_eps.h
Log:
Correct bad arrow enpoint when parallel edges are enabled.
Modified: hugo/trunk/src/lemon/graph_to_eps.h
==============================================================================
--- hugo/trunk/src/lemon/graph_to_eps.h (original)
+++ hugo/trunk/src/lemon/graph_to_eps.h Tue Jan 18 13:23:09 2005
@@ -153,6 +153,8 @@
typedef typename Graph::InEdgeIt InEdgeIt;
typedef typename Graph::OutEdgeIt OutEdgeIt;
+ static const int INTERPOL_PREC=20;
+
bool dontPrint;
enum NodeShapes { CIRCLE=0, SQUARE=1 };
@@ -517,21 +519,20 @@
xy<double> mm=m+rot(d)*sw/.75;
if(_drawArrows) {
int node_shape;
- const int INERPOL_PREC=20;
xy<double> s=_coords[g.source(*e)];
xy<double> t=_coords[g.target(*e)];
double rn=_nodeSizes[g.target(*e)]*_nodeScale;
node_shape=_nodeShapes[g.target(*e)];
Bezier3 bez(s,mm,mm,t);
double t1=0,t2=1;
- for(int i=0;i<INERPOL_PREC;++i)
+ for(int i=0;i<INTERPOL_PREC;++i)
if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
else t1=(t1+t2)/2;
xy<double> apoint=bez((t1+t2)/2);
rn = _arrowLength+_edgeWidths[*e]*_edgeWidthScale;
rn*=rn;
t2=(t1+t2)/2;t1=0;
- for(int i=0;i<INERPOL_PREC;++i)
+ for(int i=0;i<INTERPOL_PREC;++i)
if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
else t2=(t1+t2)/2;
xy<double> linend=bez((t1+t2)/2);
@@ -539,7 +540,7 @@
// rn=_nodeSizes[g.source(*e)]*_nodeScale;
// node_shape=_nodeShapes[g.source(*e)];
// t1=0;t2=1;
-// for(int i=0;i<INERPOL_PREC;++i)
+// for(int i=0;i<INTERPOL_PREC;++i)
// if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t1=(t1+t2)/2;
// else t2=(t1+t2)/2;
// bez=bez.after((t1+t2)/2);
@@ -577,15 +578,20 @@
if(!_undir||g.source(e)<g.target(e))
if(_drawArrows) {
xy<double> d(_coords[g.target(e)]-_coords[g.source(e)]);
+ double rn=_nodeSizes[g.target(e)]*_nodeScale;
+ int node_shape=_nodeShapes[g.target(e)];
+ double t1=0,t2=1;
+ for(int i=0;i<INTERPOL_PREC;++i)
+ if(isInsideNode((-(t1+t2)/2)*d,rn,node_shape)) t1=(t1+t2)/2;
+ else t2=(t1+t2)/2;
double l=sqrt(d.normSquare());
d/=l;
- xy<double> x1(d*_nodeScale*_nodeSizes[g.source(e)]+
- _coords[g.source(e)]);
- os << l-(_nodeSizes[g.source(e)]+
- _nodeSizes[g.target(e)])*_nodeScale << ' '
+
+ os << l*(1-(t1+t2)/2) << ' '
<< _edgeWidths[e]*_edgeWidthScale << ' '
<< d.x << ' ' << d.y << ' '
- << x1.x << ' ' << x1.y << ' '
+ << _coords[g.source(e)].x << ' '
+ << _coords[g.source(e)].y << ' '
<< _edgeColors[e].getR() << ' '
<< _edgeColors[e].getG() << ' '
<< _edgeColors[e].getB() << " arr\n";
More information about the Lemon-commits
mailing list