forked from philipperemy/digital-setting-circles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStarData.h
55 lines (44 loc) · 1.34 KB
/
StarData.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
46
47
48
49
50
51
52
53
54
55
#include <stdbool.h>
#include "MathLib.h"
#include <cmath>
#ifndef STARDATA_H
#define STARDATA_H
class StarData
{
public:
StarData();
~StarData();
int index; // Identifies star in data list
double az, el; // Set by user or encoders
double ra, dec; // From star data list
double time; // Set to current time (minutes) when az/el is set
void clearData();
};
namespace starDataNamespace
{
// Check that all values have been meaningfully defined.
// An undefined value will have been initialized to NaN.
static bool validStarData(StarData& sd)
{
return ( MathLib::finite(sd.ra) &&
MathLib::finite(sd.dec) &&
MathLib::finite(sd.az) &&
MathLib::finite(sd.el) &&
sd.time >= 0.0 &&
sd.ra >= 0.0);
}
// Check that both stars are defined, and they are not
// the same star.
static inline bool validAlignementData(StarData& starData1, StarData& starData2)
{
return starDataNamespace::validStarData(starData1) &&
starDataNamespace::validStarData(starData2) &&
&starData1 != &starData2;
}
static inline void clearAlignmentData(StarData& starData1, StarData& starData2)
{
starData1.clearData();
starData2.clearData();
}
}
#endif // STARDATA_H