From 1563ae5be6bc130a9b3a23464f7e28fdb1e87da3 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 13 May 2017 19:01:56 +0500 Subject: 2017-05-13 --- PositionI.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'PositionI.cpp') 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; +} -- cgit v1.2.3