diff options
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; +} |