forked from GraffitiResearchLabGermany/kinectTag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHANDS.pde
45 lines (36 loc) · 1.61 KB
/
HANDS.pde
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
//-----------------------------------------------------------------------------------------
// HAND EVENTS
void onCreateHands(int handId,PVector pos,float time) {
//println("onCreateHands - handId: " + handId + ", pos: " + pos + ", time:" + time);
handsTrackFlag = true;
handVec = pos;
handVecList.clear();
handVecList.add(pos);
}
void onUpdateHands(int handId,PVector pos,float time) {
//println("onUpdateHandsCb - handId: " + handId + ", pos: " + pos + ", time:" + time);
handVec = pos;
handVecList.add(0,pos);
if(handVecList.size() >= handVecListSize) {
// remove the last point
handVecList.remove(handVecList.size()-1);
}
}
void onDestroyHands(int handId,float time) {
//println("onDestroyHandsCb - handId: " + handId + ", time:" + time);
handsTrackFlag = false;
//handVecList.clear(); // erase list to avoid ConcurrentModificationException
context.addGesture(lastGesture);
}
//-----------------------------------------------------------------------------------------
// GESTURE EVENTS
void onRecognizeGesture(String strGesture, PVector idPosition, PVector endPosition) {
//println("onRecognizeGesture - strGesture: " + strGesture + ", idPosition: " + idPosition + ", endPosition:" + endPosition);
lastGesture = strGesture;
context.removeGesture(strGesture);
context.startTrackingHands(endPosition);
}
void onProgressGesture(String strGesture, PVector position,float progress) {
//println("onProgressGesture - strGesture: " + strGesture + ", position: " + position + ", progress:" + progress);
}
//-----------------------------------------------------------------------------------------