Numworks Epsilon  1.4.1
Graphing Calculator Operating System
point.h
Go to the documentation of this file.
1 #ifndef KANDINSKY_POINT_H
2 #define KANDINSKY_POINT_H
3 
4 #include <kandinsky/coordinate.h>
5 
6 class KDPoint {
7 public:
9  m_x(x), m_y(y) {}
10  KDCoordinate x() const { return m_x; }
11  KDCoordinate y() const { return m_y; }
12  KDPoint translatedBy(KDPoint other) const;
13  KDPoint opposite() const;
14  bool operator ==(const KDPoint &other) const {
15  return (m_x == other.m_x && m_y == other.m_y);
16  }
17  bool operator !=(const KDPoint &other) const {
18  return !(operator ==(other));
19  }
20 private:
21  KDCoordinate m_x;
22  KDCoordinate m_y;
23 };
24 
25 constexpr KDPoint KDPointZero = KDPoint(0,0);
26 
27 #endif
KDCoordinate y() const
Definition: point.h:11
bool operator!=(const KDPoint &other) const
Definition: point.h:17
int16_t KDCoordinate
Definition: coordinate.h:6
constexpr KDPoint KDPointZero
Definition: point.h:25
Definition: point.h:6
constexpr KDPoint(KDCoordinate x, KDCoordinate y)
Definition: point.h:8
bool operator==(const KDPoint &other) const
Definition: point.h:14
KDPoint opposite() const
Definition: point.cpp:7
KDCoordinate x() const
Definition: point.h:10
KDPoint translatedBy(KDPoint other) const
Definition: point.cpp:3