#ifndef __GEOMETRY_HPP__ #define __GEOMETRY_HPP__ namespace geometry { /** * Computes the Euclidean distance between two points (x1, y1) and (x2, y2). * * @param x1 a double * @param y1 a double * @param x2 a double * @param y2 a double * @return the Euclidean distance between (x1, y1) and (x2, y2) */ double euclideanDistance(double x1, double y1, double x2, double y2); class Point { public: /** * Initializes this point to the origin (0, 0). */ Point(); /** * Initializes this point to (x, y). * * @param x a double * @param y a double */ Point(double x, double y); /** * Calculates the Euclidean distance from this point to the given point. * * @param p a point * @return the distance from this point to p */ double distanceTo(const Point& p) const; private: /** * The x-coordinate of this point. */ double x; /** * The y-coordinate of this point. */ double y; }; } #endif