COIN-OR::LEMON - Graph Library

Changeset 2207:75a29ac69c19 in lemon-0.x for lemon


Ignore:
Timestamp:
09/07/06 15:27:16 (18 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2933
Message:

xy -> dim2::Point

Location:
lemon
Files:
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • lemon/Makefile.am

    r2202 r2207  
    4242        lemon/dfs.h \
    4343        lemon/dijkstra.h \
     44        lemon/dim2.h \
    4445        lemon/dimacs.h \
    4546        lemon/edge_set.h \
     
    9394        lemon/topology.h \
    9495        lemon/ugraph_adaptor.h \
    95         lemon/unionfind.h \
    96         lemon/xy.h
     96        lemon/unionfind.h
    9797
    9898bits_HEADERS += \
  • lemon/bits/bezier.h

    r2178 r2207  
    2828///\author Alpar Juttner
    2929
    30 #include<lemon/xy.h>
     30#include<lemon/dim2.h>
    3131
    3232namespace lemon {
     33  namespace dim2 {
    3334
    3435class BezierBase {
    3536public:
    36   typedef xy<double> xy;
     37  typedef Point<double> Point;
    3738protected:
    38   static xy conv(xy x,xy y,double t) {return (1-t)*x+t*y;}
     39  static Point conv(Point x,Point y,double t) {return (1-t)*x+t*y;}
    3940};
    4041
     
    4243{
    4344public:
    44   xy p1,p2;
     45  Point p1,p2;
    4546
    4647  Bezier1() {}
    47   Bezier1(xy _p1, xy _p2) :p1(_p1), p2(_p2) {}
     48  Bezier1(Point _p1, Point _p2) :p1(_p1), p2(_p2) {}
    4849 
    49   xy operator()(double t) const
     50  Point operator()(double t) const
    5051  {
    5152    //    return conv(conv(p1,p2,t),conv(p2,p3,t),t);
     
    6465  Bezier1 revert() const { return Bezier1(p2,p1);}
    6566  Bezier1 operator()(double a,double b) const { return before(b).after(a/b); }
    66   xy grad() const { return p2-p1; }
    67   xy norm() const { return rot90(p2-p1); }
    68   xy grad(double) const { return grad(); }
    69   xy norm(double t) const { return rot90(grad(t)); }
     67  Point grad() const { return p2-p1; }
     68  Point norm() const { return rot90(p2-p1); }
     69  Point grad(double) const { return grad(); }
     70  Point norm(double t) const { return rot90(grad(t)); }
    7071};
    7172
     
    7374{
    7475public:
    75   xy p1,p2,p3;
     76  Point p1,p2,p3;
    7677
    7778  Bezier2() {}
    78   Bezier2(xy _p1, xy _p2, xy _p3) :p1(_p1), p2(_p2), p3(_p3) {}
     79  Bezier2(Point _p1, Point _p2, Point _p3) :p1(_p1), p2(_p2), p3(_p3) {}
    7980  Bezier2(const Bezier1 &b) : p1(b.p1), p2(conv(b.p1,b.p2,.5)), p3(b.p2) {}
    80   xy operator()(double t) const
     81  Point operator()(double t) const
    8182  {
    8283    //    return conv(conv(p1,p2,t),conv(p2,p3,t),t);
     
    8586  Bezier2 before(double t) const
    8687  {
    87     xy q(conv(p1,p2,t));
    88     xy r(conv(p2,p3,t));
     88    Point q(conv(p1,p2,t));
     89    Point r(conv(p2,p3,t));
    8990    return Bezier2(p1,q,conv(q,r,t));
    9091  }
     
    9293  Bezier2 after(double t) const
    9394  {
    94     xy q(conv(p1,p2,t));
    95     xy r(conv(p2,p3,t));
     95    Point q(conv(p1,p2,t));
     96    Point r(conv(p2,p3,t));
    9697    return Bezier2(conv(q,r,t),r,p3);
    9798  }
     
    100101  Bezier1 grad() const { return Bezier1(2.0*(p2-p1),2.0*(p3-p2)); }
    101102  Bezier1 norm() const { return Bezier1(2.0*rot90(p2-p1),2.0*rot90(p3-p2)); }
    102   xy grad(double t) const { return grad()(t); }
    103   xy norm(double t) const { return rot90(grad(t)); }
     103  Point grad(double t) const { return grad()(t); }
     104  Point norm(double t) const { return rot90(grad(t)); }
    104105};
    105106
     
    107108{
    108109public:
    109   xy p1,p2,p3,p4;
     110  Point p1,p2,p3,p4;
    110111
    111112  Bezier3() {}
    112   Bezier3(xy _p1, xy _p2, xy _p3, xy _p4) :p1(_p1), p2(_p2), p3(_p3), p4(_p4) {}
     113  Bezier3(Point _p1, Point _p2, Point _p3, Point _p4)
     114    : p1(_p1), p2(_p2), p3(_p3), p4(_p4) {}
    113115  Bezier3(const Bezier1 &b) : p1(b.p1), p2(conv(b.p1,b.p2,1.0/3.0)),
    114116                              p3(conv(b.p1,b.p2,2.0/3.0)), p4(b.p2) {}
     
    116118                              p3(conv(b.p2,b.p3,1.0/3.0)), p4(b.p3) {}
    117119 
    118   xy operator()(double t) const
     120  Point operator()(double t) const
    119121    {
    120122      //    return Bezier2(conv(p1,p2,t),conv(p2,p3,t),conv(p3,p4,t))(t);
     
    124126  Bezier3 before(double t) const
    125127    {
    126       xy p(conv(p1,p2,t));
    127       xy q(conv(p2,p3,t));
    128       xy r(conv(p3,p4,t));
    129       xy a(conv(p,q,t));
    130       xy b(conv(q,r,t));
    131       xy c(conv(a,b,t));
     128      Point p(conv(p1,p2,t));
     129      Point q(conv(p2,p3,t));
     130      Point r(conv(p3,p4,t));
     131      Point a(conv(p,q,t));
     132      Point b(conv(q,r,t));
     133      Point c(conv(a,b,t));
    132134      return Bezier3(p1,p,a,c);
    133135    }
     
    135137  Bezier3 after(double t) const
    136138    {
    137       xy p(conv(p1,p2,t));
    138       xy q(conv(p2,p3,t));
    139       xy r(conv(p3,p4,t));
    140       xy a(conv(p,q,t));
    141       xy b(conv(q,r,t));
    142       xy c(conv(a,b,t));
     139      Point p(conv(p1,p2,t));
     140      Point q(conv(p2,p3,t));
     141      Point r(conv(p3,p4,t));
     142      Point a(conv(p,q,t));
     143      Point b(conv(q,r,t));
     144      Point c(conv(a,b,t));
    143145      return Bezier3(c,b,r,p4);
    144146    }
     
    149151                                  3.0*rot90(p3-p2),
    150152                                  3.0*rot90(p4-p3)); }
    151   xy grad(double t) const { return grad()(t); }
    152   xy norm(double t) const { return rot90(grad(t)); }
     153  Point grad(double t) const { return grad()(t); }
     154  Point norm(double t) const { return rot90(grad(t)); }
    153155
    154156  template<class R,class F,class S,class D>
    155157  R recSplit(F &_f,const S &_s,D _d) const
    156158  {
    157     const xy a=(p1+p2)/2;
    158     const xy b=(p2+p3)/2;
    159     const xy c=(p3+p4)/2;
    160     const xy d=(a+b)/2;
    161     const xy e=(b+c)/2;
    162     const xy f=(d+e)/2;
     159    const Point a=(p1+p2)/2;
     160    const Point b=(p2+p3)/2;
     161    const Point c=(p3+p4)/2;
     162    const Point d=(a+b)/2;
     163    const Point e=(b+c)/2;
     164    const Point f=(d+e)/2;
    163165    R f1=_f(Bezier3(p1,a,d,e),_d);
    164166    R f2=_f(Bezier3(e,d,c,p4),_d);
     
    168170};
    169171
    170 } //END OF NAMESPACE LEMON
     172
     173} //END OF NAMESPACE dim2
     174} //END OF NAMESPACE lemon
    171175
    172176#endif // LEMON_BEZIER_H
  • lemon/dim2.h

    r2157 r2207  
    1717 */
    1818
    19 #ifndef LEMON_XY_H
    20 #define LEMON_XY_H
     19#ifndef LEMON_DIM2_H
     20#define LEMON_DIM2_H
    2121
    2222#include <iostream>
     
    2727///\brief A simple two dimensional vector and a bounding box implementation
    2828///
    29 /// The class \ref lemon::xy "xy" implements
     29/// The class \ref lemon::dim2::Point "dim2::Point" implements
    3030///a two dimensional vector with the usual
    3131/// operations.
    3232///
    33 /// The class \ref lemon::BoundingBox "BoundingBox" can be used to determine
    34 /// the rectangular bounding box of a set of \ref lemon::xy "xy"'s.
     33/// The class \ref lemon::dim2::BoundingBox "dim2::BoundingBox"
     34/// can be used to determine
     35/// the rectangular bounding box of a set of
     36/// \ref lemon::dim2::Point "dim2::Point"'s.
    3537///
    3638///\author Attila Bernath
     
    3840
    3941namespace lemon {
     42
     43  ///Tools for handling two dimensional coordinates
     44
     45  ///This namespace is a storage of several
     46  ///tools for handling two dimensional coordinates
     47  namespace dim2 {
    4048
    4149  /// \addtogroup misc
     
    4856  /// operators.
    4957  ///
    50   ///\note As you might have noticed, this class does not follow the
    51   ///\ref naming_conv "LEMON Coding Style" (it should be called \c Xy
    52   ///according to it). There is a stupid Hungarian proverb, "A kiv&eacute;tel
    53   ///er&otilde;s&iacute;ti a szab&aacute;lyt" ("An exception
    54   ///reinforces a rule", which is
    55   ///actually a mistranslation of the Latin proverb "Exceptio probat regulam").
    56   ///This class is an example for that.
    57   ///\author Attila Bernath
    5858  template<typename T>
    59     class xy {
     59    class Point {
    6060
    6161    public:
     
    6969     
    7070      ///Default constructor
    71       xy() {}
     71      Point() {}
    7272
    7373      ///Construct an instance from coordinates
    74       xy(T a, T b) : x(a), y(b) { }
     74      Point(T a, T b) : x(a), y(b) { }
    7575
    7676
    7777      ///Conversion constructor
    78       template<class TT> xy(const xy<TT> &p) : x(p.x), y(p.y) {}
     78      template<class TT> Point(const Point<TT> &p) : x(p.x), y(p.y) {}
    7979
    8080      ///Give back the square of the norm of the vector
     
    8484 
    8585      ///Increment the left hand side by u
    86       xy<T>& operator +=(const xy<T>& u) {
     86      Point<T>& operator +=(const Point<T>& u) {
    8787        x += u.x;
    8888        y += u.y;
     
    9191 
    9292      ///Decrement the left hand side by u
    93       xy<T>& operator -=(const xy<T>& u) {
     93      Point<T>& operator -=(const Point<T>& u) {
    9494        x -= u.x;
    9595        y -= u.y;
     
    9898
    9999      ///Multiply the left hand side with a scalar
    100       xy<T>& operator *=(const T &u) {
     100      Point<T>& operator *=(const T &u) {
    101101        x *= u;
    102102        y *= u;
     
    105105
    106106      ///Divide the left hand side by a scalar
    107       xy<T>& operator /=(const T &u) {
     107      Point<T>& operator /=(const T &u) {
    108108        x /= u;
    109109        y /= u;
     
    112112 
    113113      ///Return the scalar product of two vectors
    114       T operator *(const xy<T>& u) const {
     114      T operator *(const Point<T>& u) const {
    115115        return x*u.x+y*u.y;
    116116      }
    117117 
    118118      ///Return the sum of two vectors
    119       xy<T> operator+(const xy<T> &u) const {
    120         xy<T> b=*this;
     119      Point<T> operator+(const Point<T> &u) const {
     120        Point<T> b=*this;
    121121        return b+=u;
    122122      }
    123123
    124124      ///Return the neg of the vectors
    125       xy<T> operator-() const {
    126         xy<T> b=*this;
     125      Point<T> operator-() const {
     126        Point<T> b=*this;
    127127        b.x=-b.x; b.y=-b.y;
    128128        return b;
     
    130130
    131131      ///Return the difference of two vectors
    132       xy<T> operator-(const xy<T> &u) const {
    133         xy<T> b=*this;
     132      Point<T> operator-(const Point<T> &u) const {
     133        Point<T> b=*this;
    134134        return b-=u;
    135135      }
    136136
    137137      ///Return a vector multiplied by a scalar
    138       xy<T> operator*(const T &u) const {
    139         xy<T> b=*this;
     138      Point<T> operator*(const T &u) const {
     139        Point<T> b=*this;
    140140        return b*=u;
    141141      }
    142142
    143143      ///Return a vector divided by a scalar
    144       xy<T> operator/(const T &u) const {
    145         xy<T> b=*this;
     144      Point<T> operator/(const T &u) const {
     145        Point<T> b=*this;
    146146        return b/=u;
    147147      }
    148148
    149149      ///Test equality
    150       bool operator==(const xy<T> &u) const {
     150      bool operator==(const Point<T> &u) const {
    151151        return (x==u.x) && (y==u.y);
    152152      }
    153153
    154154      ///Test inequality
    155       bool operator!=(xy u) const {
     155      bool operator!=(Point u) const {
    156156        return  (x!=u.x) || (y!=u.y);
    157157      }
     
    159159    };
    160160
    161   ///Return an xy
    162 
    163   ///Return an xy
    164   ///\relates xy
     161  ///Return an Point
     162
     163  ///Return an Point
     164  ///\relates Point
    165165  template <typename T>
    166   inline xy<T> make_xy(const T& x, const T& y) {
    167     return xy<T>(x, y);
     166  inline Point<T> make_Point(const T& x, const T& y) {
     167    return Point<T>(x, y);
    168168  }
    169169
     
    171171
    172172  ///Return a vector multiplied by a scalar
    173   ///\relates xy
    174   template<typename T> xy<T> operator*(const T &u,const xy<T> &x) {
     173  ///\relates Point
     174  template<typename T> Point<T> operator*(const T &u,const Point<T> &x) {
    175175    return x*u;
    176176  }
     
    179179
    180180  ///Read a plainvector from a stream
    181   ///\relates xy
     181  ///\relates Point
    182182  ///
    183183  template<typename T>
    184   inline std::istream& operator>>(std::istream &is, xy<T> &z) {
     184  inline std::istream& operator>>(std::istream &is, Point<T> &z) {
    185185    char c;
    186186    if (is >> c) {
     
    207207
    208208  ///Write a plainvector to a stream
    209   ///\relates xy
     209  ///\relates Point
    210210  ///
    211211  template<typename T>
    212   inline std::ostream& operator<<(std::ostream &os, const xy<T>& z)
     212  inline std::ostream& operator<<(std::ostream &os, const Point<T>& z)
    213213  {
    214214    os << "(" << z.x << ", " << z.y << ")";
     
    219219
    220220  ///Returns its parameter rotated by 90 degrees in positive direction.
    221   ///\relates xy
     221  ///\relates Point
    222222  ///
    223223  template<typename T>
    224   inline xy<T> rot90(const xy<T> &z)
    225   {
    226     return xy<T>(-z.y,z.x);
     224  inline Point<T> rot90(const Point<T> &z)
     225  {
     226    return Point<T>(-z.y,z.x);
    227227  }
    228228
     
    230230
    231231  ///Returns its parameter rotated by 180 degrees.
    232   ///\relates xy
     232  ///\relates Point
    233233  ///
    234234  template<typename T>
    235   inline xy<T> rot180(const xy<T> &z)
    236   {
    237     return xy<T>(-z.x,-z.y);
     235  inline Point<T> rot180(const Point<T> &z)
     236  {
     237    return Point<T>(-z.x,-z.y);
    238238  }
    239239
     
    241241
    242242  ///Returns its parameter rotated by 90 degrees in negative direction.
    243   ///\relates xy
     243  ///\relates Point
    244244  ///
    245245  template<typename T>
    246   inline xy<T> rot270(const xy<T> &z)
    247   {
    248     return xy<T>(z.y,-z.x);
     246  inline Point<T> rot270(const Point<T> &z)
     247  {
     248    return Point<T>(z.y,-z.x);
    249249  }
    250250
     
    258258  template<typename T>
    259259    class BoundingBox {
    260       xy<T> bottom_left, top_right;
     260      Point<T> bottom_left, top_right;
    261261      bool _empty;
    262262    public:
     
    266266
    267267      ///Construct an instance from one point
    268       BoundingBox(xy<T> a) { bottom_left=top_right=a; _empty = false; }
     268      BoundingBox(Point<T> a) { bottom_left=top_right=a; _empty = false; }
    269269
    270270      ///Were any points added?
     
    282282      ///Give back the bottom left corner.
    283283      ///If the bounding box is empty, then the return value is not defined.
    284       xy<T> bottomLeft() const {
     284      Point<T> bottomLeft() const {
    285285        return bottom_left;
    286286      }
     
    290290      ///Set the bottom left corner.
    291291      ///It should only bee used for non-empty box.
    292       void bottomLeft(xy<T> p) {
     292      void bottomLeft(Point<T> p) {
    293293        bottom_left = p;
    294294      }
     
    298298      ///Give back the top right corner.
    299299      ///If the bounding box is empty, then the return value is not defined.
    300       xy<T> topRight() const {
     300      Point<T> topRight() const {
    301301        return top_right;
    302302      }
     
    306306      ///Set the top right corner.
    307307      ///It should only bee used for non-empty box.
    308       void topRight(xy<T> p) {
     308      void topRight(Point<T> p) {
    309309        top_right = p;
    310310      }
     
    314314      ///Give back the bottom right corner.
    315315      ///If the bounding box is empty, then the return value is not defined.
    316       xy<T> bottomRight() const {
    317         return xy<T>(top_right.x,bottom_left.y);
     316      Point<T> bottomRight() const {
     317        return Point<T>(top_right.x,bottom_left.y);
    318318      }
    319319
     
    322322      ///Set the bottom right corner.
    323323      ///It should only bee used for non-empty box.
    324       void bottomRight(xy<T> p) {
     324      void bottomRight(Point<T> p) {
    325325        top_right.x = p.x;
    326326        bottom_left.y = p.y;
     
    331331      ///Give back the top left corner.
    332332      ///If the bounding box is empty, then the return value is not defined.
    333       xy<T> topLeft() const {
    334         return xy<T>(bottom_left.x,top_right.y);
     333      Point<T> topLeft() const {
     334        return Point<T>(bottom_left.x,top_right.y);
    335335      }
    336336
     
    339339      ///Set the top left corner.
    340340      ///It should only bee used for non-empty box.
    341       void topLeft(xy<T> p) {
     341      void topLeft(Point<T> p) {
    342342        top_right.y = p.y;
    343343        bottom_left.x = p.x;
     
    425425
    426426      ///Checks whether a point is inside a bounding box
    427       bool inside(const xy<T>& u){
     427      bool inside(const Point<T>& u){
    428428        if (_empty)
    429429          return false;
     
    435435 
    436436      ///Increments a bounding box with a point
    437       BoundingBox& add(const xy<T>& u){
     437      BoundingBox& add(const Point<T>& u){
    438438        if (_empty){
    439439          bottom_left=top_right=u;
     
    450450 
    451451//       ///Sums a bounding box and a point
    452 //       BoundingBox operator +(const xy<T>& u){
     452//       BoundingBox operator +(const Point<T>& u){
    453453//         BoundingBox b = *this;
    454454//         return b += u;
     
    486486
    487487
    488   ///Map of x-coordinates of an xy<>-map
     488  ///Map of x-coordinates of a dim2::Point<>-map
    489489
    490490  ///\ingroup maps
     
    551551  }
    552552
    553   ///Map of y-coordinates of an xy<>-map
     553  ///Map of y-coordinates of a dim2::Point<>-map
    554554   
    555555  ///\ingroup maps
     
    617617
    618618
    619   ///Map of the \ref xy::normSquare() "normSquare()" of an \ref xy "xy"-map
    620 
    621   ///Map of the \ref xy::normSquare() "normSquare()" of an \ref xy "xy"-map
     619  ///Map of the \ref Point::normSquare() "normSquare()" of an \ref Point "Point"-map
     620
     621  ///Map of the \ref Point::normSquare() "normSquare()" of an \ref Point "Point"-map
    622622  ///\ingroup maps
    623623  ///
     
    649649  /// @}
    650650
    651 
     651  } //namespce dim2
     652 
    652653} //namespace lemon
    653654
    654 #endif //LEMON_XY_H
     655#endif //LEMON_DIM2_H
  • lemon/eps.cc

    r2013 r2207  
    7070  }
    7171
    72   EpsDrawer::EpsDrawer(std::ostream &os,xy<double> s) : local_stream(false),
     72  EpsDrawer::EpsDrawer(std::ostream &os,dim2::Point<double> s) : local_stream(false),
    7373                                                        out(os)
    7474  {
     
    7676  }
    7777
    78   EpsDrawer::EpsDrawer(std::ostream &os,xy<double> a, xy<double> b) :
     78  EpsDrawer::EpsDrawer(std::ostream &os,dim2::Point<double> a, dim2::Point<double> b) :
    7979    local_stream(false),
    8080    out(os)
     
    9898  }
    9999 
    100   EpsDrawer::EpsDrawer(const std::string &name,xy<double> s) :
     100  EpsDrawer::EpsDrawer(const std::string &name,dim2::Point<double> s) :
    101101    local_stream(true),
    102102    out(*new std::ofstream(name.c_str()))
     
    105105  }
    106106
    107   EpsDrawer::EpsDrawer(const std::string &name,xy<double> a, xy<double> b) :
     107  EpsDrawer::EpsDrawer(const std::string &name,dim2::Point<double> a, dim2::Point<double> b) :
    108108    local_stream(true),
    109109    out(*new std::ofstream(name.c_str()))
  • lemon/eps.h

    r2174 r2207  
    2525#include<sstream>
    2626#include<lemon/color.h>
    27 #include<lemon/xy.h>
     27#include<lemon/dim2.h>
    2828
    2929  ///\ingroup eps_io
     
    101101    ///\c s determines the upper
    102102    ///right corner of the bounding box. The lower left corner is (0,0).
    103     EpsDrawer(std::ostream &os,xy<double> s);
     103    EpsDrawer(std::ostream &os,dim2::Point<double> s);
    104104    ///\e
    105105
     
    109109    /// determine the lower left and the upper right corners of
    110110    ///the bounding box, respectively.
    111     EpsDrawer(std::ostream &os,xy<double> a, xy<double> b);
     111    EpsDrawer(std::ostream &os,dim2::Point<double> a, dim2::Point<double> b);
    112112    ///\e
    113113
     
    131131    ///\c s determines the upper
    132132    ///right corner of the bounding box. The lower left corner is (0,0).
    133     EpsDrawer(const std::string &name,xy<double> s);
     133    EpsDrawer(const std::string &name,dim2::Point<double> s);
    134134    ///\e
    135135
     
    139139    /// determine the lower left and the upper right corners of
    140140    ///the bounding box, respectively.
    141     EpsDrawer(const std::string &name,xy<double> a, xy<double> b);
     141    EpsDrawer(const std::string &name,dim2::Point<double> a, dim2::Point<double> b);
    142142
    143143//     template<class T> EpsDrawer(std::ostream &os,BoundingBox<T> b)
     
    169169   
    170170    ///Draw a line
    171     template<class T> EpsDrawer &line(xy<T> p1,xy<T> p2)
     171    template<class T> EpsDrawer &line(dim2::Point<T> p1,dim2::Point<T> p2)
    172172    {
    173173      return line(p1.x,p1.y,p2.x,p2.y);
    174174    }
    175175    ///Draw a line from the current point
    176     template<class T> EpsDrawer &lineTo(xy<T> p)
     176    template<class T> EpsDrawer &lineTo(dim2::Point<T> p)
    177177    {
    178178      return lineTo(p.x,p.y);
    179179    }
    180180    ///Move the current point
    181     template<class T> EpsDrawer &moveTo(xy<T> p)
     181    template<class T> EpsDrawer &moveTo(dim2::Point<T> p)
    182182    {
    183183      return moveTo(p.x,p.y);
    184184    }
    185185    ///Draw a circle
    186     template<class T> EpsDrawer &circle(xy<T> p, double r)
     186    template<class T> EpsDrawer &circle(dim2::Point<T> p, double r)
    187187    {
    188188      return circle(p.x,p.y,r);
     
    297297    ///\param brd Color of the node border. The default color is black
    298298    template<class T>
    299     EpsDrawer &node(NodeShapes t, xy<T> pos, double r,
     299    EpsDrawer &node(NodeShapes t, dim2::Point<T> pos, double r,
    300300                    Color col=WHITE, Color brd=BLACK)
    301301    {
     
    306306    EpsDrawer &translate(double x,double y);
    307307    ///Translate the coordinate system
    308     template<class T> EpsDrawer &translate(xy<T> p)
     308    template<class T> EpsDrawer &translate(dim2::Point<T> p)
    309309    {
    310310      return translate(p.x,p.y);
     
    317317    EpsDrawer &scale(double s) { return scale(s,s); }
    318318    ///Scale the coordinate system
    319     template<class T> EpsDrawer &scale(xy<T> p)
     319    template<class T> EpsDrawer &scale(dim2::Point<T> p)
    320320    {
    321321      return scale(p.x,p.y);
     
    337337    ///Print a coordinate at the current point
    338338    template<class T>
    339     EpsDrawer &operator<<(xy<T> p)
     339    EpsDrawer &operator<<(dim2::Point<T> p)
    340340    {
    341341      out << "((" << p.x << ',' << p.y <<")) show\n";
  • lemon/graph_to_eps.h

    r2178 r2207  
    3636
    3737#include<lemon/bits/invalid.h>
    38 #include<lemon/xy.h>
     38#include<lemon/dim2.h>
    3939#include<lemon/maps.h>
    4040#include<lemon/color.h>
     
    8282  std::ostream& os;
    8383 
    84   typedef ConstMap<typename Graph::Node,xy<double> > CoordsMapType;
     84  typedef ConstMap<typename Graph::Node,dim2::Point<double> > CoordsMapType;
    8585  CoordsMapType _coords;
    8686  ConstMap<typename Graph::Node,double > _nodeSizes;
     
    147147                          bool _pros=false) :
    148148    g(_g), os(_os),
    149     _coords(xy<double>(1,1)), _nodeSizes(.01), _nodeShapes(0),
     149    _coords(dim2::Point<double>(1,1)), _nodeSizes(.01), _nodeShapes(0),
    150150    _nodeColors(WHITE), _edgeColors(BLACK),
    151151    _edgeWidths(1.0), _edgeWidthScale(0.003),
     
    314314  }
    315315  template<class TT>
    316   static std::string psOut(const xy<TT> &p)
     316  static std::string psOut(const dim2::Point<TT> &p)
    317317    {
    318318      std::ostringstream os;   
     
    338338
    339339  ///Sets the map of the node coordinates.
    340   ///\param x must be a node map with xy<double> or \ref xy "xy<int>" values.
     340  ///\param x must be a node map with dim2::Point<double> or
     341  ///\ref dim2::Point "dim2::Point<int>" values.
    341342  template<class X> GraphToEps<CoordsTraits<X> > coords(const X &x) {
    342343    dontPrint=true;
     
    670671
    671672protected:
    672   bool isInsideNode(xy<double> p, double r,int t)
     673  bool isInsideNode(dim2::Point<double> p, double r,int t)
    673674  {
    674675    switch(t) {
     
    737738    double diag_len = 1;
    738739    if(!(_absoluteNodeSizes&&_absoluteEdgeWidths)) {
    739       BoundingBox<double> bb;
     740      dim2::BoundingBox<double> bb;
    740741      for(NodeIt n(g);n!=INVALID;++n) bb.add(mycoords[n]);
    741742      if (bb.empty()) {
    742         bb = BoundingBox<double>(xy<double>(0,0));
     743        bb = dim2::BoundingBox<double>(dim2::Point<double>(0,0));
    743744      }
    744745      diag_len = std::sqrt((bb.bottomLeft()-bb.topRight()).normSquare());
     
    748749    }
    749750   
    750     BoundingBox<double> bb;
     751    dim2::BoundingBox<double> bb;
    751752    for(NodeIt n(g);n!=INVALID;++n) {
    752753      double ns=_nodeSizes[n]*_nodeScale;
    753       xy<double> p(ns,ns);
     754      dim2::Point<double> p(ns,ns);
    754755      switch(_nodeShapes[n]) {
    755756      case CIRCLE:
     
    761762      case MALE:
    762763        bb.add(-p+mycoords[n]);
    763         bb.add(xy<double>(1.5*ns,1.5*std::sqrt(3.0)*ns)+mycoords[n]);
     764        bb.add(dim2::Point<double>(1.5*ns,1.5*std::sqrt(3.0)*ns)+mycoords[n]);
    764765        break;
    765766      case FEMALE:
    766767        bb.add(p+mycoords[n]);
    767         bb.add(xy<double>(-ns,-3.01*ns)+mycoords[n]);
     768        bb.add(dim2::Point<double>(-ns,-3.01*ns)+mycoords[n]);
    768769        break;
    769770      }
    770771    }
    771772    if (bb.empty()) {
    772       bb = BoundingBox<double>(xy<double>(0,0));
     773      bb = dim2::BoundingBox<double>(dim2::Point<double>(0,0));
    773774    }
    774775   
     
    871872                  (A4WIDTH-2*A4BORDER)/bb.width());
    872873        os << ((A4WIDTH -2*A4BORDER)-sc*bb.width())/2 + A4BORDER << ' '
    873            << ((A4HEIGHT-2*A4BORDER)-sc*bb.height())/2 + A4BORDER << " translate\n"
     874           << ((A4HEIGHT-2*A4BORDER)-sc*bb.height())/2 + A4BORDER
     875           << " translate\n"
    874876           << sc << " dup scale\n"
    875877           << -bb.left() << ' ' << -bb.bottom() << " translate\n";
     
    880882                  (A4WIDTH-2*A4BORDER)/bb.height());
    881883        os << ((A4WIDTH -2*A4BORDER)-sc*bb.height())/2 + A4BORDER << ' '
    882            << ((A4HEIGHT-2*A4BORDER)-sc*bb.width())/2 + A4BORDER  << " translate\n"
     884           << ((A4HEIGHT-2*A4BORDER)-sc*bb.width())/2 + A4BORDER
     885           << " translate\n"
    883886           << sc << " dup scale\n90 rotate\n"
    884887           << -bb.left() << ' ' << -bb.top() << " translate\n";
     
    905908          sw-=_parEdgeDist;
    906909          sw/=-2.0;
    907           xy<double> dvec(mycoords[g.target(*i)]-mycoords[g.source(*i)]);
     910          dim2::Point<double>
     911            dvec(mycoords[g.target(*i)]-mycoords[g.source(*i)]);
    908912          double l=std::sqrt(dvec.normSquare());
    909913          ///\todo better 'epsilon' would be nice here.
    910           xy<double> d(dvec/std::max(l,EPSILON));
    911           xy<double> m;
    912 //        m=xy<double>(mycoords[g.target(*i)]+mycoords[g.source(*i)])/2.0;
    913 
    914 //        m=xy<double>(mycoords[g.source(*i)])+
     914          dim2::Point<double> d(dvec/std::max(l,EPSILON));
     915          dim2::Point<double> m;
     916//        m=dim2::Point<double>(mycoords[g.target(*i)]+mycoords[g.source(*i)])/2.0;
     917
     918//        m=dim2::Point<double>(mycoords[g.source(*i)])+
    915919//          dvec*(double(_nodeSizes[g.source(*i)])/
    916920//             (_nodeSizes[g.source(*i)]+_nodeSizes[g.target(*i)]));
    917921
    918           m=xy<double>(mycoords[g.source(*i)])+
     922          m=dim2::Point<double>(mycoords[g.source(*i)])+
    919923            d*(l+_nodeSizes[g.source(*i)]-_nodeSizes[g.target(*i)])/2.0;
    920924
    921925          for(typename std::vector<Edge>::iterator e=i;e!=j;++e) {
    922926            sw+=_edgeWidths[*e]*_edgeWidthScale/2.0;
    923             xy<double> mm=m+rot90(d)*sw/.75;
     927            dim2::Point<double> mm=m+rot90(d)*sw/.75;
    924928            if(_drawArrows) {
    925929              int node_shape;
    926               xy<double> s=mycoords[g.source(*e)];
    927               xy<double> t=mycoords[g.target(*e)];
     930              dim2::Point<double> s=mycoords[g.source(*e)];
     931              dim2::Point<double> t=mycoords[g.target(*e)];
    928932              double rn=_nodeSizes[g.target(*e)]*_nodeScale;
    929933              node_shape=_nodeShapes[g.target(*e)];
    930               Bezier3 bez(s,mm,mm,t);
     934              dim2::Bezier3 bez(s,mm,mm,t);
    931935              double t1=0,t2=1;
    932936              for(int i=0;i<INTERPOL_PREC;++i)
    933937                if(isInsideNode(bez((t1+t2)/2)-t,rn,node_shape)) t2=(t1+t2)/2;
    934938                else t1=(t1+t2)/2;
    935               xy<double> apoint=bez((t1+t2)/2);
     939              dim2::Point<double> apoint=bez((t1+t2)/2);
    936940              rn = _arrowLength+_edgeWidths[*e]*_edgeWidthScale;
    937941              rn*=rn;
     
    940944                if((bez((t1+t2)/2)-apoint).normSquare()>rn) t1=(t1+t2)/2;
    941945                else t2=(t1+t2)/2;
    942               xy<double> linend=bez((t1+t2)/2);       
     946              dim2::Point<double> linend=bez((t1+t2)/2);             
    943947              bez=bez.before((t1+t2)/2);
    944948//            rn=_nodeSizes[g.source(*e)]*_nodeScale;
     
    957961                 << bez.p3.x << ' ' << bez.p3.y << ' '
    958962                 << bez.p4.x << ' ' << bez.p4.y << " curveto stroke\n";
    959               xy<double> dd(rot90(linend-apoint));
     963              dim2::Point<double> dd(rot90(linend-apoint));
    960964              dd*=(.5*_edgeWidths[*e]*_edgeWidthScale+_arrowWidth)/
    961965                std::sqrt(dd.normSquare());
     
    983987           &&g.source(e)!=g.target(e))
    984988          if(_drawArrows) {
    985             xy<double> d(mycoords[g.target(e)]-mycoords[g.source(e)]);
     989            dim2::Point<double> d(mycoords[g.target(e)]-mycoords[g.source(e)]);
    986990            double rn=_nodeSizes[g.target(e)]*_nodeScale;
    987991            int node_shape=_nodeShapes[g.target(e)];
  • lemon/grid_ugraph.h

    r2151 r2207  
    2727#include <lemon/bits/graph_extender.h>
    2828
    29 #include <lemon/xy.h>
     29#include <lemon/dim2.h>
    3030
    3131///\ingroup graphs
     
    382382    typedef ExtendedGridUGraphBase Parent;
    383383
    384     /// \brief Map to get the indices of the nodes as xy<int>.
    385     ///
    386     /// Map to get the indices of the nodes as xy<int>.
     384    /// \brief Map to get the indices of the nodes as dim2::Point<int>.
     385    ///
     386    /// Map to get the indices of the nodes as dim2::Point<int>.
    387387    class IndexMap {
    388388    public:
     
    390390      typedef GridUGraph::Node Key;
    391391      /// \brief The value type of the map
    392       typedef xy<int> Value;
     392      typedef dim2::Point<int> Value;
    393393
    394394      /// \brief Constructor
     
    401401      /// The subscript operator.
    402402      Value operator[](Key key) const {
    403         return xy<int>(graph.row(key), graph.col(key));
     403        return dim2::Point<int>(graph.row(key), graph.col(key));
    404404      }
    405405
  • lemon/hypercube_graph.h

    r2111 r2207  
    276276    /// const int DIM = 3;
    277277    /// HyperCubeGraph graph(DIM);
    278     /// xy<double> base[DIM];
     278    /// dim2::Point<double> base[DIM];
    279279    /// for (int k = 0; k < DIM; ++k) {
    280280    ///   base[k].x = rand() / (RAND_MAX + 1.0);
    281281    ///   base[k].y = rand() / (RAND_MAX + 1.0);
    282282    /// }
    283     /// HyperCubeGraph::HyperMap<xy<double> >
    284     ///   pos(graph, base, base + DIM, xy<double>(0.0, 0.0));
     283    /// HyperCubeGraph::HyperMap<dim2::Point<double> >
     284    ///   pos(graph, base, base + DIM, dim2::Point<double>(0.0, 0.0));
    285285    ///\endcode
    286286    ///
  • lemon/lemon_reader.h

    r2153 r2207  
    3939#include <lemon/bits/item_reader.h>
    4040
    41 #include <lemon/xy.h>
     41#include <lemon/dim2.h>
    4242
    4343#include <lemon/concept_check.h>
     
    184184
    185185    template <typename Map>
    186     struct Ref<XMap<Map> > {
    187       typedef XMap<Map> Type;
     186    struct Ref<dim2::XMap<Map> > {
     187      typedef dim2::XMap<Map> Type;
    188188    };
    189189    template <typename Map>
    190     struct Arg<XMap<Map> > {
    191       typedef const XMap<Map>& Type;
     190    struct Arg<dim2::XMap<Map> > {
     191      typedef const dim2::XMap<Map>& Type;
    192192    };
    193193
    194194    template <typename Map>
    195     struct Ref<YMap<Map> > {
    196       typedef YMap<Map> Type;
     195    struct Ref<dim2::YMap<Map> > {
     196      typedef dim2::YMap<Map> Type;
    197197    };
    198198    template <typename Map>
    199     struct Arg<YMap<Map> > {
    200       typedef const YMap<Map>& Type;
     199    struct Arg<dim2::YMap<Map> > {
     200      typedef const dim2::YMap<Map>& Type;
    201201    };
    202202
  • lemon/lemon_writer.h

    r2101 r2207  
    3838#include <lemon/bits/utility.h>
    3939#include <lemon/maps.h>
    40 #include <lemon/xy.h>
     40#include <lemon/dim2.h>
    4141
    4242#include <lemon/concept_check.h>
     
    174174
    175175    template <typename Map>
    176     struct Ref<XMap<Map> > {
    177       typedef XMap<Map> Type;
     176    struct Ref<dim2::XMap<Map> > {
     177      typedef dim2::XMap<Map> Type;
    178178    };
    179179    template <typename Map>
    180     struct Ref<ConstXMap<Map> > {
    181       typedef ConstXMap<Map> Type;
     180    struct Ref<dim2::ConstXMap<Map> > {
     181      typedef dim2::ConstXMap<Map> Type;
    182182    };
    183183
    184184    template <typename Map>
    185     struct Ref<YMap<Map> > {
    186       typedef YMap<Map> Type;
     185    struct Ref<dim2::YMap<Map> > {
     186      typedef dim2::YMap<Map> Type;
    187187    };
    188188    template <typename Map>
    189     struct Ref<ConstYMap<Map> > {
    190       typedef ConstYMap<Map> Type;
     189    struct Ref<dim2::ConstYMap<Map> > {
     190      typedef dim2::ConstYMap<Map> Type;
    191191    };
    192192
  • lemon/polynomial.h

    r2199 r2207  
    7777    ///The following examples shows the usage of the template parameter \c R.
    7878    ///\code
    79     ///  Polynomial<xy<double> > line(1);
    80     ///  line[0]=xy<double>(12,25);
    81     ///  line[1]=xy<double>(2,7);
     79    ///  Polynomial<dim2::Point<double> > line(1);
     80    ///  line[0]=dim2::Point<double>(12,25);
     81    ///  line[1]=dim2::Point<double>(2,7);
    8282    ///  ...
    83     ///  xy<double> d = line.subst<xy<double> >(23.2);
     83    ///  dim2::Point<double> d = line.subst<dim2::Point<double> >(23.2);
    8484    ///\endcode
    8585    ///
Note: See TracChangeset for help on using the changeset viewer.