forked from jordi-petit/ap2-moduls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoint.hh
51 lines (32 loc) · 1.18 KB
/
Point.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef Point_hh
#define Point_hh
/** The Point class stores a two dimensional point in the plane
and provides some usefull operations for it.
*/
class Point {
public:
/** Constructor. */
Point (double x_coord=0, double y_coord=0);
/** Gets the x coordinate of this point. */
double get_x () const;
/** Gets the y coordinate of this point. */
double get_y () const;
/** Returns the distance to point p from this point. */
double distance (const Point& p) const;
/** Returns the radius of this point (distance from the origin). */
double radius () const;
/** Returns the angle of the polar coordinate of this point. */
double angle () const;
/** Compares this point to point p. */
bool operator== (const Point& p) const;
/** Compares this point to point p. */
bool operator!= (const Point& p) const;
/** Adds the coordinates of p to this point and returns this point. */
Point& operator+= (const Point& p);
/** Returns the point resulting of adding the coordinates of this point and p. */
Point operator+ (const Point& p) const;
private:
/** Coordinates of the point. */
double x, y;
};
#endif