src/proto2/Vector.hh
author terom
Tue, 18 Nov 2008 19:17:56 +0000
changeset 54 b8b043ba0abd
parent 53 a76ddb2e39fb
child 55 8ae9dd0ae337
permissions -rw-r--r--
fix some more compiler errors...
#ifndef COOR_H
#define COOR_H

//#define TYPE double

template <typename TYPE>
class coor {
public:
    TYPE x;
    TYPE y;
    coor() {
        x = 0; y = 0;
    }
    coor(TYPE X, TYPE Y) {
        x = X;
        y = Y;
    }
    coor(const coor& c) {
        x = c.x;
        y = c.y;
    }
    void operator = (const coor& c) {
        x = c.x;
        y = c.y;
    }
    coor operator + (const coor& c) {
        return coor(x+c.x, y+c.y);
    }
    coor operator - (const coor& c) {
        return coor(x-c.x, y-c.y);
    }
    void operator += (const coor& c) {
        x += c.x;
        y += c.y;
    }
    coor operator * (const double d) {
        return coor(x*d, y*d);
    }

};

template<typename T>
bool operator== (const coor<T>& c1, const coor<T>& c2) {
    return ((c1.x == c2.x) && (c1.y == c2.y));
}

#endif