1. bool JointHitDetector::DetectHit(ofxVec3f& vDir)
2. {
3. int numTrackedPoints = mPoints.size();
4. if (numTrackedPoints < 3)
5. return false;
6.
7. ofxVec3f A = mPoints[1] - mPoints[0];
8. ofxVec3f B = mPoints[2] - mPoints[1];
9.
10. for (int i=2; i<=numTrackedPoints; ++i)
11. {
12. //printf("*** i = %i\n", i);
13. //printf("A = (%f,%f,%f) B = (%f,%f,%f)\n", A.x, A.y, A.z, B.x, B.y, B.z);
14. ofxVec3f C = mPoints[numTrackedPoints > i ? i : i-1] - mPoints[i-1];
15. ofxVec3f normA = A.getNormalized();
16. ofxVec3f normB = B.getNormalized();
17.
18. static float _shortEnough = 30.0f;
19. if (LongEnough(A) && (normA.dot(normB) < .1f || B.length() < _shortEnough))
20. {
21. vDir = A;
22. for (int j=0; j<i; ++j) //erase the A part, keep the B
23. mPoints.erase(mPoints.begin());
24. return true;
25. }
26. else if (normA.dot(normB) > .8f || (LongEnough(A) && normA.dot(normB) > .4f))
27. {
28. A = A+B; B = C;
29. }
30. else
31. {
32. A = B; B = C;
33. }
34. }
35.
36. return false;
37. }
38.
39. bool JointHitDetector::LongEnough(const ofxVec3f& vec) const
40. {
41. return vec.lengthSquared() > mRequiredLength * mRequiredLength;
42. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1: error: ‘JointHitDetector’ has not been declared
prog.cpp:1: error: ‘ofxVec3f’ was not declared in this scope
prog.cpp:1: error: ‘vDir’ was not declared in this scope
prog.cpp:2: error: expected ‘,’ or ‘;’ before ‘{’ token
stdout

Standard output is empty