proto/coor.hh
author nireco
Fri, 31 Oct 2008 07:23:24 +0000
changeset 1 085631252347
permissions -rw-r--r--
added some small proto
#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