-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIrArray.cpp
More file actions
52 lines (34 loc) · 716 Bytes
/
Copy pathIrArray.cpp
File metadata and controls
52 lines (34 loc) · 716 Bytes
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
#include "IrArray.h"
#include <cmath>
void CIRArray::CalcStats() {
float temp;
bool doinitflag = true;
int count = 0;
for (int x = 0; x < data.size(); x++) {
temp = data[x];
if (isnan(temp)) continue;
count++;
if (doinitflag) {
tMin = temp;
tMax = temp;
tAvg = temp;
doinitflag = false;
}
if (temp > tMax) {
tMax = temp;
}
if (temp < tMin) {
tMin = temp;
}
tSum = temp + tSum;
tWeightedSum = temp*(x+1) + tWeightedSum;
}
tAvg = tSum / count;
tCentroid = (tWeightedSum / tSum)-1;
};
int CIRArray::GetX() {
return tCentroid / rowsize;
}
int CIRArray::GetY() {
return (int)tCentroid % rowsize;
}