From c4d48213273aad8d1c076ea44238dd65c75d9961 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 11 Oct 2020 12:56:33 +0300 Subject: Control updates --- src/math/Vector2D.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/math') 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 -- cgit v1.2.3 From 1f36b78c205202b605797e6e29ba045124066705 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 13:48:08 +0300 Subject: Pickup fixes --- src/math/Vector.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/math') diff --git a/src/math/Vector.h b/src/math/Vector.h index 7ee01149..badc40e3 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(sq(x) + sq(y)); +} + class CMatrix; CVector Multiply3x3(const CMatrix &mat, const CVector &vec); -- cgit v1.2.3 From ca64a49af11c8d3cca79587641e5ad464cb276f3 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 17 Oct 2020 14:23:31 +0300 Subject: fix build --- src/math/Vector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/math') diff --git a/src/math/Vector.h b/src/math/Vector.h index badc40e3..082b296f 100644 --- a/src/math/Vector.h +++ b/src/math/Vector.h @@ -120,7 +120,7 @@ Distance2D(const CVector &v1, const CVector &v2) { float x = v2.x - v1.x; float y = v2.y - v1.y; - return Sqrt(sq(x) + sq(y)); + return Sqrt(x*x + y*y); } class CMatrix; -- cgit v1.2.3