COIN-OR::LEMON - Graph Library

Changeset 1391:5b46af577b23 in lemon-0.x for src/lemon/xy.h


Ignore:
Timestamp:
04/26/05 17:50:30 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1846
Message:
  • BoundingBox::clear() added
  • More "-pedantic" code
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/xy.h

    r1359 r1391  
    6868      T normSquare() const {
    6969        return x*x+y*y;
    70       };
     70      }
    7171 
    7272      ///Increments the left hand side by u
     
    7575        y += u.y;
    7676        return *this;
    77       };
     77      }
    7878 
    7979      ///Decrements the left hand side by u
     
    8282        y -= u.y;
    8383        return *this;
    84       };
     84      }
    8585
    8686      ///Multiplying the left hand side with a scalar
     
    8989        y *= u;
    9090        return *this;
    91       };
     91      }
    9292
    9393      ///Dividing the left hand side by a scalar
     
    9696        y /= u;
    9797        return *this;
    98       };
     98      }
    9999 
    100100      ///Returns the scalar product of two vectors
    101101      T operator *(const xy<T>& u) const {
    102102        return x*u.x+y*u.y;
    103       };
     103      }
    104104 
    105105      ///Returns the sum of two vectors
     
    107107        xy<T> b=*this;
    108108        return b+=u;
    109       };
     109      }
    110110
    111111      ///Returns the neg of the vectors
     
    114114        b.x=-b.x; b.y=-b.y;
    115115        return b;
    116       };
     116      }
    117117
    118118      ///Returns the difference of two vectors
     
    120120        xy<T> b=*this;
    121121        return b-=u;
    122       };
     122      }
    123123
    124124      ///Returns a vector multiplied by a scalar
     
    126126        xy<T> b=*this;
    127127        return b*=u;
    128       };
     128      }
    129129
    130130      ///Returns a vector divided by a scalar
     
    132132        xy<T> b=*this;
    133133        return b/=u;
    134       };
     134      }
    135135
    136136      ///Testing equality
    137137      bool operator==(const xy<T> &u) const {
    138138        return (x==u.x) && (y==u.y);
    139       };
     139      }
    140140
    141141      ///Testing inequality
    142142      bool operator!=(xy u) const {
    143143        return  (x!=u.x) || (y!=u.y);
    144       };
     144      }
    145145
    146146    };
     
    152152  template<typename T> xy<T> operator*(const T &u,const xy<T> &x) {
    153153    return x*u;
    154   };
     154  }
    155155
    156156  ///Read a plainvector from a stream
     
    227227      }
    228228
     229      ///Makes the BoundingBox empty
     230      void clear() {
     231        _empty=1;
     232      }
     233
    229234      ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined)
    230235      xy<T> bottomLeft() const {
    231236        return bottom_left;
    232       };
     237      }
    233238
    234239      ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined)
    235240      xy<T> topRight() const {
    236241        return top_right;
    237       };
     242      }
    238243
    239244      ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined)
    240245      xy<T> bottomRight() const {
    241246        return xy<T>(top_right.x,bottom_left.y);
    242       };
     247      }
    243248
    244249      ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined)
    245250      xy<T> topLeft() const {
    246251        return xy<T>(bottom_left.x,top_right.y);
    247       };
     252      }
    248253
    249254      ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined)
    250255      T bottom() const {
    251256        return bottom_left.y;
    252       };
     257      }
    253258
    254259      ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined)
    255260      T top() const {
    256261        return top_right.y;
    257       };
     262      }
    258263
    259264      ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined)
    260265      T left() const {
    261266        return bottom_left.x;
    262       };
     267      }
    263268
    264269      ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined)
    265270      T right() const {
    266271        return top_right.x;
    267       };
     272      }
    268273
    269274      ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined)
    270275      T height() const {
    271276        return top_right.y-bottom_left.y;
    272       };
     277      }
    273278
    274279      ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined)
    275280      T width() const {
    276281        return top_right.x-bottom_left.x;
    277       };
     282      }
    278283
    279284      ///Checks whether a point is inside a bounding box
     
    300305        }
    301306        return *this;
    302       };
     307      }
    303308 
    304309      ///Sums a bounding box and a point
     
    306311        BoundingBox b = *this;
    307312        return b += u;
    308       };
     313      }
    309314
    310315      ///Increments a bounding box with an other bounding box
     
    315320        }
    316321        return *this;
    317       };
     322      }
    318323 
    319324      ///Sums two bounding boxes
     
    321326        BoundingBox b = *this;
    322327        return b += u;
    323       };
     328      }
    324329
    325330    };//class Boundingbox
Note: See TracChangeset for help on using the changeset viewer.