-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathPoint.h
45 lines (39 loc) · 779 Bytes
/
Point.h
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
#ifndef _POINT_H_
#define _POINT_H_
/* QND N-Dimensional Point class
* (c) 2011 Christopher "ScribbleJ" Jansen
*
*/
#include "Globals.h"
#include "config.h"
// Quick and dirty point class
class Point
{
public:
float axes[NUM_AXES];
Point()
{
for(int ax=0;ax<NUM_AXES;ax++)
axes[ax] = 0.0f;
}
// Convenience constructor for LCDKeypad
Point(float amount, int x)
{
for(int ax=0;ax<NUM_AXES;ax++)
axes[ax] = 0.0f;
axes[x] = amount;
}
Point& operator=(const Point& tocopy)
{
for(int ax=0;ax<NUM_AXES;ax++)
axes[ax] = tocopy.axes[ax];
return *this;
}
Point(const Point& tocopy)
{
*this = tocopy;
}
// No bounds checking
float& operator[](int idx) { return axes[idx]; }
};
#endif // _POINT_H_