src/lemon/xy.h
changeset 1257 7101e2c3a881
parent 1202 da44ee225dad
child 1317 83f80464f111
     1.1 --- a/src/lemon/xy.h	Fri Mar 25 08:18:27 2005 +0000
     1.2 +++ b/src/lemon/xy.h	Fri Mar 25 08:21:43 2005 +0000
     1.3 @@ -38,9 +38,9 @@
     1.4    /// \addtogroup misc
     1.5    /// @{
     1.6  
     1.7 -  /// A two dimensional vector (plainvector) implementation
     1.8 +  /// A simple two dimensional vector (plainvector) implementation
     1.9  
    1.10 -  /// A two dimensional vector (plainvector) implementation
    1.11 +  /// A simple two dimensional vector (plainvector) implementation
    1.12    ///with the usual vector
    1.13    /// operators.
    1.14    ///
    1.15 @@ -54,8 +54,8 @@
    1.16  
    1.17        T x,y;     
    1.18        
    1.19 -      ///Default constructor: both coordinates become 0
    1.20 -      xy() : x(0), y(0) {}
    1.21 +      ///Default constructor
    1.22 +      xy() {}
    1.23  
    1.24        ///Constructing the instance from coordinates
    1.25        xy(T a, T b) : x(a), y(b) { }
    1.26 @@ -65,40 +65,40 @@
    1.27        template<class TT> xy(const xy<TT> &p) : x(p.x), y(p.y) {}
    1.28  
    1.29        ///Gives back the square of the norm of the vector
    1.30 -      T normSquare(){
    1.31 +      T normSquare() const {
    1.32  	return x*x+y*y;
    1.33        };
    1.34    
    1.35        ///Increments the left hand side by u
    1.36 -      xy<T>& operator +=(const xy<T>& u){
    1.37 +      xy<T>& operator +=(const xy<T>& u) {
    1.38  	x += u.x;
    1.39  	y += u.y;
    1.40  	return *this;
    1.41        };
    1.42    
    1.43        ///Decrements the left hand side by u
    1.44 -      xy<T>& operator -=(const xy<T>& u){
    1.45 +      xy<T>& operator -=(const xy<T>& u) {
    1.46  	x -= u.x;
    1.47  	y -= u.y;
    1.48  	return *this;
    1.49        };
    1.50  
    1.51        ///Multiplying the left hand side with a scalar
    1.52 -      xy<T>& operator *=(const T &u){
    1.53 +      xy<T>& operator *=(const T &u) {
    1.54  	x *= u;
    1.55  	y *= u;
    1.56  	return *this;
    1.57        };
    1.58  
    1.59        ///Dividing the left hand side by a scalar
    1.60 -      xy<T>& operator /=(const T &u){
    1.61 +      xy<T>& operator /=(const T &u) {
    1.62  	x /= u;
    1.63  	y /= u;
    1.64  	return *this;
    1.65        };
    1.66    
    1.67        ///Returns the scalar product of two vectors
    1.68 -      T operator *(const xy<T>& u){
    1.69 +      T operator *(const xy<T>& u) const {
    1.70  	return x*u.x+y*u.y;
    1.71        };
    1.72    
    1.73 @@ -134,12 +134,12 @@
    1.74        };
    1.75  
    1.76        ///Testing equality
    1.77 -      bool operator==(const xy<T> &u){
    1.78 +      bool operator==(const xy<T> &u) const {
    1.79  	return (x==u.x) && (y==u.y);
    1.80        };
    1.81  
    1.82        ///Testing inequality
    1.83 -      bool operator!=(xy u){
    1.84 +      bool operator!=(xy u) const {
    1.85  	return  (x!=u.x) || (y!=u.y);
    1.86        };
    1.87