diff -r 9c8e464ed940 -r 5b46af577b23 src/lemon/xy.h --- a/src/lemon/xy.h Mon Apr 25 16:22:04 2005 +0000 +++ b/src/lemon/xy.h Tue Apr 26 15:50:30 2005 +0000 @@ -67,81 +67,81 @@ ///Gives back the square of the norm of the vector T normSquare() const { return x*x+y*y; - }; + } ///Increments the left hand side by u xy& operator +=(const xy& u) { x += u.x; y += u.y; return *this; - }; + } ///Decrements the left hand side by u xy& operator -=(const xy& u) { x -= u.x; y -= u.y; return *this; - }; + } ///Multiplying the left hand side with a scalar xy& operator *=(const T &u) { x *= u; y *= u; return *this; - }; + } ///Dividing the left hand side by a scalar xy& operator /=(const T &u) { x /= u; y /= u; return *this; - }; + } ///Returns the scalar product of two vectors T operator *(const xy& u) const { return x*u.x+y*u.y; - }; + } ///Returns the sum of two vectors xy operator+(const xy &u) const { xy b=*this; return b+=u; - }; + } ///Returns the neg of the vectors xy operator-() const { xy b=*this; b.x=-b.x; b.y=-b.y; return b; - }; + } ///Returns the difference of two vectors xy operator-(const xy &u) const { xy b=*this; return b-=u; - }; + } ///Returns a vector multiplied by a scalar xy operator*(const T &u) const { xy b=*this; return b*=u; - }; + } ///Returns a vector divided by a scalar xy operator/(const T &u) const { xy b=*this; return b/=u; - }; + } ///Testing equality bool operator==(const xy &u) const { return (x==u.x) && (y==u.y); - }; + } ///Testing inequality bool operator!=(xy u) const { return (x!=u.x) || (y!=u.y); - }; + } }; @@ -151,7 +151,7 @@ ///\relates xy template xy operator*(const T &u,const xy &x) { return x*u; - }; + } ///Read a plainvector from a stream @@ -226,55 +226,60 @@ return _empty; } + ///Makes the BoundingBox empty + void clear() { + _empty=1; + } + ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined) xy bottomLeft() const { return bottom_left; - }; + } ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined) xy topRight() const { return top_right; - }; + } ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined) xy bottomRight() const { return xy(top_right.x,bottom_left.y); - }; + } ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined) xy topLeft() const { return xy(bottom_left.x,top_right.y); - }; + } ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined) T bottom() const { return bottom_left.y; - }; + } ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined) T top() const { return top_right.y; - }; + } ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined) T left() const { return bottom_left.x; - }; + } ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined) T right() const { return top_right.x; - }; + } ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined) T height() const { return top_right.y-bottom_left.y; - }; + } ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined) T width() const { return top_right.x-bottom_left.x; - }; + } ///Checks whether a point is inside a bounding box bool inside(const xy& u){ @@ -299,13 +304,13 @@ if (top_right.y < u.y) top_right.y = u.y; } return *this; - }; + } ///Sums a bounding box and a point BoundingBox operator +(const xy& u){ BoundingBox b = *this; return b += u; - }; + } ///Increments a bounding box with an other bounding box BoundingBox& operator +=(const BoundingBox &u){ @@ -314,13 +319,13 @@ *this += u.topRight(); } return *this; - }; + } ///Sums two bounding boxes BoundingBox operator +(const BoundingBox& u){ BoundingBox b = *this; return b += u; - }; + } };//class Boundingbox