aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/vector.h
diff options
context:
space:
mode:
authorThomas Fach-Pedersen2018-05-07 19:17:13 +0200
committerThomas Fach-Pedersen2018-05-07 19:17:13 +0200
commite3363635cbac7f3b0f322e3cd2c532e97cff6abb (patch)
treeab8452fb70732effb6dd199e20ef00ecb4d56829 /engines/bladerunner/vector.h
parent4be77793a42a739dafb6cf20b64ffb7e245fe8e2 (diff)
downloadscummvm-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.h12
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);
}