-
Notifications
You must be signed in to change notification settings - Fork 0
/
smoothing.cpp
45 lines (34 loc) · 828 Bytes
/
smoothing.cpp
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
#include "stdafx.h"
#include "smoothing.h"
#include <map>
#include <list>
#define SMOOTHSIZE 8
#define GRABTHRES 0.6
int grabList[SMOOTHSIZE];
int index =0;
int sum;
static std::list<int> smoothlist;
/********************************************************
Hand smoothing
********************************************************/
void smoothHand(int i){
smoothlist.push_front(i);
// Keep size of history buffer
if (smoothlist.size() > SMOOTHSIZE)
smoothlist.pop_back();
}
bool isGrabsmooth(){
//find average
int sum =0, count = 0;
std::list<int>::const_iterator grabIterator;
for (grabIterator = smoothlist.begin();
grabIterator != smoothlist.end();
++grabIterator){
sum += *grabIterator;
count++;
}
if(sum/count > GRABTHRES) return true;
else return false;
}
void deleteSmHand(int id){
}