[Lemon-commits] [lemon_svn] alpar: r1846 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:48:10 CET 2006
Author: alpar
Date: Tue Apr 26 17:50:30 2005
New Revision: 1846
Modified:
hugo/trunk/src/lemon/xy.h
Log:
- BoundingBox::clear() added
- More "-pedantic" code
Modified: hugo/trunk/src/lemon/xy.h
==============================================================================
--- hugo/trunk/src/lemon/xy.h (original)
+++ hugo/trunk/src/lemon/xy.h Tue Apr 26 17:50:30 2005
@@ -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<T>& operator +=(const xy<T>& u) {
x += u.x;
y += u.y;
return *this;
- };
+ }
///Decrements the left hand side by u
xy<T>& operator -=(const xy<T>& u) {
x -= u.x;
y -= u.y;
return *this;
- };
+ }
///Multiplying the left hand side with a scalar
xy<T>& operator *=(const T &u) {
x *= u;
y *= u;
return *this;
- };
+ }
///Dividing the left hand side by a scalar
xy<T>& operator /=(const T &u) {
x /= u;
y /= u;
return *this;
- };
+ }
///Returns the scalar product of two vectors
T operator *(const xy<T>& u) const {
return x*u.x+y*u.y;
- };
+ }
///Returns the sum of two vectors
xy<T> operator+(const xy<T> &u) const {
xy<T> b=*this;
return b+=u;
- };
+ }
///Returns the neg of the vectors
xy<T> operator-() const {
xy<T> b=*this;
b.x=-b.x; b.y=-b.y;
return b;
- };
+ }
///Returns the difference of two vectors
xy<T> operator-(const xy<T> &u) const {
xy<T> b=*this;
return b-=u;
- };
+ }
///Returns a vector multiplied by a scalar
xy<T> operator*(const T &u) const {
xy<T> b=*this;
return b*=u;
- };
+ }
///Returns a vector divided by a scalar
xy<T> operator/(const T &u) const {
xy<T> b=*this;
return b/=u;
- };
+ }
///Testing equality
bool operator==(const xy<T> &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<typename T> xy<T> operator*(const T &u,const xy<T> &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<T> 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<T> 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<T> bottomRight() const {
return xy<T>(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<T> topLeft() const {
return xy<T>(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<T>& 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<T>& 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
More information about the Lemon-commits
mailing list