Testing Complete.
[asgard.git] / src / Coordinate.h
blobe7cb03ac821a0026237bb28867323a2667adeb95
1 /*****************************************************************************
2 * Copyright (c) 2007 Russ Adams, Sean Eubanks, Asgard Contributors
3 * This file is part of Asgard.
4 *
5 * Asgard is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * Asgard is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Asgard; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 ****************************************************************************/
20 #ifndef COORDINATE_H
21 #define COORDINATE_H
23 class Coordinate
25 public:
26 Coordinate();
27 Coordinate(int x, int y);
28 Coordinate(const Coordinate& copyme);
30 void operator+= (const Coordinate rhwc);
31 void operator-= (const Coordinate rhwc);
33 Coordinate operator+ (const Coordinate rhwc) const;
34 Coordinate operator- (const Coordinate rhwc) const;
36 // scaling arithmetic
37 Coordinate operator+ (const int scalar) const;
38 Coordinate operator- (const int scalar) const;
39 Coordinate operator* (const int scalar) const;
40 Coordinate operator/ (const int scalar) const;
41 friend Coordinate operator+(const int scalar, const Coordinate& wc);
42 friend Coordinate operator-(const int scalar, const Coordinate& wc);
43 friend Coordinate operator*(const int scalar, const Coordinate& wc);
44 friend Coordinate operator/(const int scalar, const Coordinate& wc);
46 bool operator== (const Coordinate rhwc) const;
47 bool operator!= (const Coordinate rhwc) const;
48 bool operator> (const Coordinate rhwc) const;
49 bool operator< (const Coordinate rhwc) const;
50 bool operator<= (const Coordinate rhwc) const;
51 bool operator>= (const Coordinate rhwc) const;
53 friend double distance(const Coordinate&,const Coordinate&);
55 private:
56 int x,y;
58 #endif //COORDINATE_H