From e1bf5e2d436998503904e6217ba3e50eaeef9822 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 Sep 2016 12:45:47 -0400 Subject: TITANIC: Flesh out the FPoint class --- engines/titanic/star_control/fpoint.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'engines/titanic/star_control/fpoint.h') diff --git a/engines/titanic/star_control/fpoint.h b/engines/titanic/star_control/fpoint.h index f2cef18ea5..33181d937b 100644 --- a/engines/titanic/star_control/fpoint.h +++ b/engines/titanic/star_control/fpoint.h @@ -34,6 +34,25 @@ public: public: FPoint() : _x(0), _y(0) {} FPoint(double x, double y) : _x(x), _y(y) {} + + bool operator==(const FPoint &p) const { return _x == p._x && _y == p._y; } + bool operator!=(const FPoint &p) const { return _x != p._x || _y != p._y; } + + void operator+=(const FPoint &delta) { + _x += delta._x; + _y += delta._y; + } + + void operator-=(const FPoint &delta) { + _x -= delta._x; + _y -= delta._y; + } + + /** + * Normalises the X and Y coordinates as fractions relative to the + * value of the hypotenuse formed by a triangle from the origin (0,0) + */ + void normalize(); }; } // End of namespace Titanic -- cgit v1.2.3