/* * Katie Lewis * April 2004 * Note: In codeing this referred to code examples from Professor Kuenning * and Matt Gnaizda. */ #include #include #include #include #include "location.hh" using namespace std; Location::Location() : x(0), y(0), z(0) { } Location::~Location() { } Location::Location(const double& x_, const double& y_, const double& z_) : x(x_), y(y_), z(z_) { } Location& Location::operator=(const Location& input) { x = input.x; y = input.y; z = input.z; return *this; } Location::Location(const Location& input) : x(input.x), y(input.y), z(input.z) { } const bool Location::operator==(const Location& rhs) const { if (x == rhs.x && y == rhs.y && z == rhs.z) return true; else return false; } double Location::distance(const Location& A, const Location& B) { return sqrt((A.x - B.x)*(A.x - B.x) + (A.y - B.y)*(A.y - B.y) + (A.z - B.z)*(A.z - B.z)); } double Location::distance(const Location& B) { return sqrt((x - B.x)*(x - B.x) + (y - B.y)*(y - B.y) + (z - B.z)*(z - B.z)); }