blip  0.1
Point.hpp
Go to the documentation of this file.
1 #ifndef __blip_Point_hpp
2 #define __blip_Point_hpp
3 
4 #include <blip/Blip.hpp>
5 
6 namespace blip {
7 
13 template<typename T> class Point
14 {
15  public:
16 
18  Point(T x, T y)
19  : _x(x), _y(y)
20  { }
21 
23  ~Point() { }
24 
26  T getX() const
27  { return(_x); }
28 
30  void setX(T x)
31  { _x = x; }
32 
34  T getY() const
35  { return(_y); }
36 
38  void setY(T y)
39  { _y = y; }
40 
42  Point& operator+=(const Point& other)
43  {
44  _x += other._x;
45  _y += other._y;
46  return(*this);
47  }
48 
50  Point& operator-=(const Point& other)
51  {
52  _x -= other._x;
53  _y -= other._y;
54  return(*this);
55  }
56 
57  private:
58 
59  T _x;
60  T _y;
61 };
62 
63 } // namespace blip
64 
65 #endif // __blip_Point_hpp
Point(T x, T y)
Construct a new point with the given coordinates.
Definition: Point.hpp:18
void setY(T y)
Set the y coordinate.
Definition: Point.hpp:38
A cartesian point: a value with x and y coordinates.
Definition: Point.hpp:13
Point & operator+=(const Point &other)
Add a point to this one.
Definition: Point.hpp:42
void setX(T x)
Set the x coordinate.
Definition: Point.hpp:30
WAV file format details at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
Definition: AccelerometerSensorEvent.cpp:3
T getY() const
Get the y coordinate.
Definition: Point.hpp:34
~Point()
Destructor.
Definition: Point.hpp:23
T getX() const
Get the x coordinate.
Definition: Point.hpp:26
Point & operator-=(const Point &other)
Subtract a point from this one.
Definition: Point.hpp:50