summaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
authorRoman Masanin <36927roma@gmail.com>2020-10-24 13:20:08 +0200
committerRoman Masanin <36927roma@gmail.com>2020-10-24 13:20:08 +0200
commit39b7075502b91172e557ec17932dfd68c7da96a1 (patch)
tree681194f8c652968c3e525d7c10c25d35e04d499b /src/math
parentpeds (diff)
parentmore ScriptSounds (diff)
downloadre3-39b7075502b91172e557ec17932dfd68c7da96a1.tar
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.gz
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.bz2
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.lz
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.xz
re3-39b7075502b91172e557ec17932dfd68c7da96a1.tar.zst
re3-39b7075502b91172e557ec17932dfd68c7da96a1.zip
Diffstat (limited to 'src/math')
-rw-r--r--src/math/Vector.h8
-rw-r--r--src/math/Vector2D.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/math/Vector.h b/src/math/Vector.h
index 7ee01149..082b296f 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
return (v2 - v1).Magnitude();
}
+inline float
+Distance2D(const CVector &v1, const CVector &v2)
+{
+ float x = v2.x - v1.x;
+ float y = v2.y - v1.y;
+ return Sqrt(x*x + y*y);
+}
+
class CMatrix;
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
diff --git a/src/math/Vector2D.h b/src/math/Vector2D.h
index 2c4e57b5..deabd0b1 100644
--- a/src/math/Vector2D.h
+++ b/src/math/Vector2D.h
@@ -53,6 +53,9 @@ public:
CVector2D operator/(float t) const {
return CVector2D(x/t, y/t);
}
+ CVector2D operator-() const {
+ return CVector2D(-x, -y);
+ }
};
inline float