COIN-OR::LEMON - Graph Library

Changeset 1087:d496d1d5a5e7 in lemon-0.x


Ignore:
Timestamp:
01/18/05 13:23:09 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1483
Message:

Correct bad arrow enpoint when parallel edges are enabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/graph_to_eps.h

    r1086 r1087  
    153153  typedef typename Graph::InEdgeIt InEdgeIt;
    154154  typedef typename Graph::OutEdgeIt OutEdgeIt;
     155
     156  static const int INTERPOL_PREC=20;
    155157
    156158  bool dontPrint;
     
    518520            if(_drawArrows) {
    519521              int node_shape;
    520               const int INERPOL_PREC=20;
    521522              xy<double> s=_coords[g.source(*e)];
    522523              xy<double> t=_coords[g.target(*e)];
     
    525526              Bezier3 bez(s,mm,mm,t);
    526527              double t1=0,t2=1;
    527               for(int i=0;i<INERPOL_PREC;++i)
     528              for(int i=0;i<INTERPOL_PREC;++i)
    528529                if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
    529530                else t1=(t1+t2)/2;
     
    532533              rn*=rn;
    533534              t2=(t1+t2)/2;t1=0;
    534               for(int i=0;i<INERPOL_PREC;++i)
     535              for(int i=0;i<INTERPOL_PREC;++i)
    535536                if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
    536537                else t2=(t1+t2)/2;
     
    540541//            node_shape=_nodeShapes[g.source(*e)];
    541542//            t1=0;t2=1;
    542 //            for(int i=0;i<INERPOL_PREC;++i)
     543//            for(int i=0;i<INTERPOL_PREC;++i)
    543544//              if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t1=(t1+t2)/2;
    544545//              else t2=(t1+t2)/2;
     
    578579          if(_drawArrows) {
    579580            xy<double> d(_coords[g.target(e)]-_coords[g.source(e)]);
     581            double rn=_nodeSizes[g.target(e)]*_nodeScale;
     582            int node_shape=_nodeShapes[g.target(e)];
     583            double t1=0,t2=1;
     584            for(int i=0;i<INTERPOL_PREC;++i)
     585              if(isInsideNode((-(t1+t2)/2)*d,rn,node_shape)) t1=(t1+t2)/2;
     586              else t2=(t1+t2)/2;
    580587            double l=sqrt(d.normSquare());
    581588            d/=l;
    582             xy<double> x1(d*_nodeScale*_nodeSizes[g.source(e)]+
    583                           _coords[g.source(e)]);
    584             os << l-(_nodeSizes[g.source(e)]+
    585                      _nodeSizes[g.target(e)])*_nodeScale << ' '
     589           
     590            os << l*(1-(t1+t2)/2) << ' '
    586591               << _edgeWidths[e]*_edgeWidthScale << ' '
    587592               << d.x << ' ' << d.y << ' '
    588                << x1.x << ' ' << x1.y << ' '
     593               << _coords[g.source(e)].x << ' '
     594               << _coords[g.source(e)].y << ' '
    589595               << _edgeColors[e].getR() << ' '
    590596               << _edgeColors[e].getG() << ' '
Note: See TracChangeset for help on using the changeset viewer.