-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise.cpp
More file actions
executable file
·54 lines (47 loc) · 1.38 KB
/
Exercise.cpp
File metadata and controls
executable file
·54 lines (47 loc) · 1.38 KB
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
#include "Exercise.h"
#include "Skeleton.h"
int Relation::RepStatus(Skeleton Sk)
{
if( threshold > 0)
{
if (Sk.getJointAngle(joint1, joint2, joint3) > angle) return 1;
if (Sk.getJointAngle(joint1, joint2, joint3) < angle - threshold) return -1;
}
else
{
if (Sk.getJointAngle(joint1, joint2, joint3) < angle) return 1;
if (Sk.getJointAngle(joint1, joint2, joint3) > angle - threshold) return -1;
}
return 0;
}
void Exercise::checkRepetitions(Skeleton Sk)
{
int curStatus = RepRel.RepStatus(Sk);
if( curStatus == 1 && up == false){
repetitions++;
up = true;
}
else if( curStatus == -1 && up == true)
{
up = false;
}
}
bool Relation::validate( Skeleton Sk)
{
if(vectical_check)
{
if(abs (Sk.getVerticalAngle(joint1, joint2) - angle) > threshold){
Sk.jointGet(joint1).setTexture(-1);
return false;
}
}
else
{
if(abs (Sk.getJointAngle(joint1, joint2, joint3) - angle) > threshold){
Sk.jointGet(joint1).setTexture(-1);
return false;
}
}
Sk.jointGet(joint1).setTexture(1);
return true;
}