// Force class implementation // -------------------------- // To allow this class to be used independently, funtions that // interact with other physical quantity classes are not defined // here. See Newton.cpp for some of them. #include "global.hpp" #include "Force.hpp" Force Force::operator-() const {return Force(-value[0], -value[1], -value[2]);} Force& Force::operator+=(FORCE rs) {value[0]+=rs.value[0]; value[1]+=rs.value[1]; value[2]+=rs.value[2]; return *this; } Force& Force::operator-=(FORCE rs) {value[0]-=rs.value[0]; value[1]-=rs.value[1]; value[2]-=rs.value[2]; return *this; } Force& Force::operator*=(DOUBLE rs) {value[0]*=rs; value[1]*=rs; value[2]*=rs; return *this;} Force& Force::operator/=(DOUBLE rs) {value[0]/=rs; value[1]/=rs; value[2]/=rs; return *this;} bool Force::operator==(FORCE rs) const {return value[0] == rs.value[0] && value[1] == rs.value[1] && value[2] == rs.value[2]; } bool Force::operator<(FORCE rs) const {return magnitude() < rs.magnitude();} ostream& operator<<(ostream& ls, FORCE rs) {return ls << '(' << rs.x() << ',' << rs.y() << ',' << rs.z() << ") dynes";}