diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-05-18 16:03:05 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-05-18 16:03:05 +0200 |
commit | 4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79 (patch) | |
tree | 548911d4e341fd5717acff3b5bc752c7b5650bf4 /code/PositionI.cpp | |
parent | 2017-05-13 (diff) | |
download | AltCraft-4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79.tar AltCraft-4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79.tar.gz AltCraft-4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79.tar.bz2 AltCraft-4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79.tar.lz AltCraft-4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79.tar.xz AltCraft-4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79.tar.zst AltCraft-4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79.zip |
Diffstat (limited to 'code/PositionI.cpp')
-rw-r--r-- | code/PositionI.cpp | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/code/PositionI.cpp b/code/PositionI.cpp deleted file mode 100644 index 7de5dc0..0000000 --- a/code/PositionI.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include <cmath> -#include "PositionI.hpp" - -PositionI::PositionI(int x, int z, int y) : m_x(x), m_y(y), m_z(z) { - -} - -PositionI::~PositionI() { - -} - -int PositionI::GetX() const { - return m_x; -} - -int PositionI::GetY() const { - return m_y; -} - -int PositionI::GetZ() const { - return m_z; -} - -void PositionI::SetX(int x) { - m_x = x; -} - -void PositionI::SetY(int y) { - m_y = y; -} - -void PositionI::setZ(int z) { - m_z = z; -} - -bool PositionI::operator==(const PositionI &other) const { - return other.m_x == m_x && other.m_z == m_z && other.m_y == other.m_y; -} - -PositionI &PositionI::operator=(const PositionI &other) { - m_y = other.m_y; - m_z = other.m_z; - m_x = other.m_x; - return *this; -} - -PositionI::PositionI(const PositionI &other) { - m_y = other.m_y; - m_z = other.m_z; - m_x = other.m_x; -} - -PositionI::PositionI() : m_x(0), m_y(0), m_z(0) { - -} - -bool PositionI::operator<(const PositionI &rhs) const { - if (m_x < rhs.m_x) - return true; - if (rhs.m_x < m_x) - return false; - if (m_y < rhs.m_y) - return true; - if (rhs.m_y < m_y) - return false; - return m_z < rhs.m_z; -} - -bool PositionI::operator>(const PositionI &rhs) const { - return rhs < *this; -} - -bool PositionI::operator<=(const PositionI &rhs) const { - return !(rhs < *this); -} - -bool PositionI::operator>=(const PositionI &rhs) const { - return !(*this < rhs); -} - -PositionI PositionI::operator-(const PositionI &other) const { - return PositionI( - m_x - other.m_x, - m_z - other.m_z, - m_y - other.m_y - ); -} - -double PositionI::GetDistance() { - return (std::sqrt(std::pow(m_x, 2) + std::pow(m_y, 2) + std::pow(m_z, 2))); -} - -PositionI PositionI::operator*(int other) const { - return PositionI( - m_x * other, - m_z * other, - m_y * other - ); -} - -PositionI PositionI::operator*(const PositionI &other) const { - return PositionI( - m_x * other.m_x, - m_z * other.m_z, - m_y * other.m_y - ); -} - -PositionI PositionI::operator/(int other) const { - return PositionI( - m_x / other, - m_z / other, - m_y / other - ); -} - -std::ostream &operator<<(std::ostream &os, const PositionI &i) { - os << "(" << i.m_x << ", " << i.m_y << ", " << i.m_z << ")"; - return os; -} |