From 18a763bcb19c5ece4b7b7d079dab07a1d915deb6 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 3 Dec 2022 00:44:07 +0100 Subject: Moved battles module files to sim --- battles/src/Point.cpp | 72 --------------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 battles/src/Point.cpp (limited to 'battles/src/Point.cpp') diff --git a/battles/src/Point.cpp b/battles/src/Point.cpp deleted file mode 100644 index 31aecae..0000000 --- a/battles/src/Point.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include - -#include - - -namespace kurator -{ -namespace battles -{ - - -double -Point::magnitude() const -{ - return std::sqrt(std::pow(x, 2) + std::pow(y, 2)); -} - - -double -Point::distance(const Point& other) const -{ - return std::sqrt(std::pow(other.x - x, 2) + std::pow(other.y - y, 2)); -} - - -double -Point::angle() const -{ - return std::atan2(y, x); // (+x, _) is 0 -} - - -Point -Point::rotate(const double angle) const -{ - return { - x * std::cos(angle) - y * std::sin(angle), - x * std::sin(angle) + y * std::cos(angle), - }; -} - - -Point -Point::scale(const double _scale) const -{ - return {x * _scale, y * _scale}; -} - - -Point -Point::normalized() const -{ - return scale(1.0 / magnitude()); -} - - -Point -Point::operator-(const Point& other) const -{ - return {x - other.x, y - other.y}; -} - - -Point -Point::operator+(const Point& other) const -{ - return {x + other.x, y + other.y}; -} - - -} // namespace battles -} // namespace kurator -- cgit v1.1