diff options
author | Thomas Fach-Pedersen | 2018-05-07 19:17:13 +0200 |
---|---|---|
committer | Thomas Fach-Pedersen | 2018-05-07 19:17:13 +0200 |
commit | e3363635cbac7f3b0f322e3cd2c532e97cff6abb (patch) | |
tree | ab8452fb70732effb6dd199e20ef00ecb4d56829 /engines/bladerunner/vector.h | |
parent | 4be77793a42a739dafb6cf20b64ffb7e245fe8e2 (diff) | |
download | scummvm-rg350-e3363635cbac7f3b0f322e3cd2c532e97cff6abb.tar.gz scummvm-rg350-e3363635cbac7f3b0f322e3cd2c532e97cff6abb.tar.bz2 scummvm-rg350-e3363635cbac7f3b0f322e3cd2c532e97cff6abb.zip |
BLADERUNNER: Implement obstacle polygon merging
Diffstat (limited to 'engines/bladerunner/vector.h')
-rw-r--r-- | engines/bladerunner/vector.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/engines/bladerunner/vector.h b/engines/bladerunner/vector.h index f3cc1f1e6d..22ef5cd839 100644 --- a/engines/bladerunner/vector.h +++ b/engines/bladerunner/vector.h @@ -37,6 +37,14 @@ public: Vector2(float ax, float ay) : x(ax), y(ay) {} }; +inline bool operator==(const Vector2 &a, const Vector2 &b) { + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const Vector2 &a, const Vector2 &b) { + return !(a == b); +} + class Vector3 { public: float x; @@ -132,6 +140,10 @@ inline float distance(float x1, float z1, float x2, float z2) { return int_part + frac_part; } +inline float distance(const Vector2 &v1, const Vector2 &v2) { + return distance(v1.x, v1.y, v2.x, v2.y); +} + inline float distance(const Vector3 &v1, const Vector3 &v2) { return distance(v1.x, v1.z, v2.x, v2.z); } |