1.1 --- a/src/lemon/xy.h Mon Apr 25 16:22:04 2005 +0000
1.2 +++ b/src/lemon/xy.h Tue Apr 26 15:50:30 2005 +0000
1.3 @@ -67,81 +67,81 @@
1.4 ///Gives back the square of the norm of the vector
1.5 T normSquare() const {
1.6 return x*x+y*y;
1.7 - };
1.8 + }
1.9
1.10 ///Increments the left hand side by u
1.11 xy<T>& operator +=(const xy<T>& u) {
1.12 x += u.x;
1.13 y += u.y;
1.14 return *this;
1.15 - };
1.16 + }
1.17
1.18 ///Decrements the left hand side by u
1.19 xy<T>& operator -=(const xy<T>& u) {
1.20 x -= u.x;
1.21 y -= u.y;
1.22 return *this;
1.23 - };
1.24 + }
1.25
1.26 ///Multiplying the left hand side with a scalar
1.27 xy<T>& operator *=(const T &u) {
1.28 x *= u;
1.29 y *= u;
1.30 return *this;
1.31 - };
1.32 + }
1.33
1.34 ///Dividing the left hand side by a scalar
1.35 xy<T>& operator /=(const T &u) {
1.36 x /= u;
1.37 y /= u;
1.38 return *this;
1.39 - };
1.40 + }
1.41
1.42 ///Returns the scalar product of two vectors
1.43 T operator *(const xy<T>& u) const {
1.44 return x*u.x+y*u.y;
1.45 - };
1.46 + }
1.47
1.48 ///Returns the sum of two vectors
1.49 xy<T> operator+(const xy<T> &u) const {
1.50 xy<T> b=*this;
1.51 return b+=u;
1.52 - };
1.53 + }
1.54
1.55 ///Returns the neg of the vectors
1.56 xy<T> operator-() const {
1.57 xy<T> b=*this;
1.58 b.x=-b.x; b.y=-b.y;
1.59 return b;
1.60 - };
1.61 + }
1.62
1.63 ///Returns the difference of two vectors
1.64 xy<T> operator-(const xy<T> &u) const {
1.65 xy<T> b=*this;
1.66 return b-=u;
1.67 - };
1.68 + }
1.69
1.70 ///Returns a vector multiplied by a scalar
1.71 xy<T> operator*(const T &u) const {
1.72 xy<T> b=*this;
1.73 return b*=u;
1.74 - };
1.75 + }
1.76
1.77 ///Returns a vector divided by a scalar
1.78 xy<T> operator/(const T &u) const {
1.79 xy<T> b=*this;
1.80 return b/=u;
1.81 - };
1.82 + }
1.83
1.84 ///Testing equality
1.85 bool operator==(const xy<T> &u) const {
1.86 return (x==u.x) && (y==u.y);
1.87 - };
1.88 + }
1.89
1.90 ///Testing inequality
1.91 bool operator!=(xy u) const {
1.92 return (x!=u.x) || (y!=u.y);
1.93 - };
1.94 + }
1.95
1.96 };
1.97
1.98 @@ -151,7 +151,7 @@
1.99 ///\relates xy
1.100 template<typename T> xy<T> operator*(const T &u,const xy<T> &x) {
1.101 return x*u;
1.102 - };
1.103 + }
1.104
1.105 ///Read a plainvector from a stream
1.106
1.107 @@ -226,55 +226,60 @@
1.108 return _empty;
1.109 }
1.110
1.111 + ///Makes the BoundingBox empty
1.112 + void clear() {
1.113 + _empty=1;
1.114 + }
1.115 +
1.116 ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined)
1.117 xy<T> bottomLeft() const {
1.118 return bottom_left;
1.119 - };
1.120 + }
1.121
1.122 ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined)
1.123 xy<T> topRight() const {
1.124 return top_right;
1.125 - };
1.126 + }
1.127
1.128 ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined)
1.129 xy<T> bottomRight() const {
1.130 return xy<T>(top_right.x,bottom_left.y);
1.131 - };
1.132 + }
1.133
1.134 ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined)
1.135 xy<T> topLeft() const {
1.136 return xy<T>(bottom_left.x,top_right.y);
1.137 - };
1.138 + }
1.139
1.140 ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined)
1.141 T bottom() const {
1.142 return bottom_left.y;
1.143 - };
1.144 + }
1.145
1.146 ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined)
1.147 T top() const {
1.148 return top_right.y;
1.149 - };
1.150 + }
1.151
1.152 ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined)
1.153 T left() const {
1.154 return bottom_left.x;
1.155 - };
1.156 + }
1.157
1.158 ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined)
1.159 T right() const {
1.160 return top_right.x;
1.161 - };
1.162 + }
1.163
1.164 ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined)
1.165 T height() const {
1.166 return top_right.y-bottom_left.y;
1.167 - };
1.168 + }
1.169
1.170 ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined)
1.171 T width() const {
1.172 return top_right.x-bottom_left.x;
1.173 - };
1.174 + }
1.175
1.176 ///Checks whether a point is inside a bounding box
1.177 bool inside(const xy<T>& u){
1.178 @@ -299,13 +304,13 @@
1.179 if (top_right.y < u.y) top_right.y = u.y;
1.180 }
1.181 return *this;
1.182 - };
1.183 + }
1.184
1.185 ///Sums a bounding box and a point
1.186 BoundingBox operator +(const xy<T>& u){
1.187 BoundingBox b = *this;
1.188 return b += u;
1.189 - };
1.190 + }
1.191
1.192 ///Increments a bounding box with an other bounding box
1.193 BoundingBox& operator +=(const BoundingBox &u){
1.194 @@ -314,13 +319,13 @@
1.195 *this += u.topRight();
1.196 }
1.197 return *this;
1.198 - };
1.199 + }
1.200
1.201 ///Sums two bounding boxes
1.202 BoundingBox operator +(const BoundingBox& u){
1.203 BoundingBox b = *this;
1.204 return b += u;
1.205 - };
1.206 + }
1.207
1.208 };//class Boundingbox
1.209