diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-05-13 16:01:56 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-05-13 16:01:56 +0200 |
commit | 1563ae5be6bc130a9b3a23464f7e28fdb1e87da3 (patch) | |
tree | b1f65a03827494fa78e320b134f4cc7df54754bb /PositionI.cpp | |
parent | 2017-05-12 (diff) | |
download | AltCraft-1563ae5be6bc130a9b3a23464f7e28fdb1e87da3.tar AltCraft-1563ae5be6bc130a9b3a23464f7e28fdb1e87da3.tar.gz AltCraft-1563ae5be6bc130a9b3a23464f7e28fdb1e87da3.tar.bz2 AltCraft-1563ae5be6bc130a9b3a23464f7e28fdb1e87da3.tar.lz AltCraft-1563ae5be6bc130a9b3a23464f7e28fdb1e87da3.tar.xz AltCraft-1563ae5be6bc130a9b3a23464f7e28fdb1e87da3.tar.zst AltCraft-1563ae5be6bc130a9b3a23464f7e28fdb1e87da3.zip |
Diffstat (limited to 'PositionI.cpp')
-rw-r--r-- | PositionI.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/PositionI.cpp b/PositionI.cpp index b9257a1..7de5dc0 100644 --- a/PositionI.cpp +++ b/PositionI.cpp @@ -89,3 +89,32 @@ PositionI PositionI::operator-(const PositionI &other) const { 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; +} |