diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-08-17 19:31:37 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-08-17 19:31:37 -0300 |
commit | e0c29962e6f334452f0c9db2caaf6ed18065de85 (patch) | |
tree | cee27801c196fbcacf6130ad64216af133b555dd /tests/libsample/point.h |
The End Is the Beginning Is the End
Diffstat (limited to 'tests/libsample/point.h')
-rw-r--r-- | tests/libsample/point.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/libsample/point.h b/tests/libsample/point.h new file mode 100644 index 000000000..e5ec9c1bc --- /dev/null +++ b/tests/libsample/point.h @@ -0,0 +1,51 @@ +#ifndef POINT_H +#define POINT_H + +#include "complex.h" +#include <utility> + +class Point +{ +public: + Point(int x = 0, int y = 0); + Point(double x, double y); + ~Point() {} + + double x() const { return m_x; } + double y() const { return m_y; } + + bool operator==(const Point& other); + Point operator+(const Point& other); + Point operator-(const Point& other); + + friend Point operator*(Point& pt, double mult); + friend Point operator*(Point& pt, int mult); + friend Point operator*(double mult, Point& pt); + friend Point operator*(int mult, Point& pt); + friend Point operator-(const Point& pt); + friend bool operator!(const Point& pt); + + Point& operator+=(Point &other); + Point& operator-=(Point &other); + + void show(); + +private: + double m_x; + double m_y; +}; + +Point operator*(Point& pt, double mult); +Point operator*(Point& pt, int mult); +Point operator*(double mult, Point& pt); +Point operator*(int mult, Point& pt); +Point operator-(const Point& pt); +bool operator!(const Point& pt); + +Complex transmutePointIntoComplex(Point point); +Point transmuteComplexIntoPoint(Complex cpx); + +Point operator*(Point& pt, double multiplier); + +#endif // POINT_H + |