src/lemon/xy.h
changeset 1049 e27446e1deda
parent 1045 1bf336c63f25
child 1071 7c70fc1b2d8b
     1.1 --- a/src/lemon/xy.h	Tue Jan 04 17:54:41 2005 +0000
     1.2 +++ b/src/lemon/xy.h	Tue Jan 04 22:14:42 2005 +0000
     1.3 @@ -61,6 +61,9 @@
     1.4        xy(T a, T b) : x(a), y(b) { }
     1.5  
     1.6  
     1.7 +      ///Conversion constructor
     1.8 +      template<class TT> xy(const xy<TT> &p) : x(p.x), y(p.y) {}
     1.9 +
    1.10        ///Gives back the square of the norm of the vector
    1.11        T normSquare(){
    1.12  	return x*x+y*y;
    1.13 @@ -105,6 +108,13 @@
    1.14  	return b+=u;
    1.15        };
    1.16  
    1.17 +      ///Returns the neg of the vectors
    1.18 +      xy<T> operator-() const {
    1.19 +	xy<T> b=*this;
    1.20 +	b.x=-b.x; b.y=-b.y;
    1.21 +	return b;
    1.22 +      };
    1.23 +
    1.24        ///Returns the difference of two vectors
    1.25        xy<T> operator-(const xy<T> &u) const {
    1.26  	xy<T> b=*this;