language: C++ 4.7.2 (gcc-4.7.2)
date: 394 days 8 hours ago
link:
visibility: public
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
bool JointHitDetector::DetectHit(ofxVec3f& vDir)
{
        int numTrackedPoints = mPoints.size();
        if (numTrackedPoints < 3)
                return false;
   
        ofxVec3f A = mPoints[1] - mPoints[0];
        ofxVec3f B = mPoints[2] - mPoints[1];
   
        for (int i=2; i<=numTrackedPoints; ++i)
        {
      //printf("*** i = %i\n", i);
      //printf("A = (%f,%f,%f)   B = (%f,%f,%f)\n", A.x, A.y, A.z, B.x, B.y, B.z);
                ofxVec3f C = mPoints[numTrackedPoints > i ? i : i-1] - mPoints[i-1];
      ofxVec3f normA = A.getNormalized();
      ofxVec3f normB = B.getNormalized();
      
      static float _shortEnough = 30.0f;
      if (LongEnough(A) && (normA.dot(normB) < .1f || B.length() < _shortEnough))
      {
         vDir = A;
         for (int j=0; j<i; ++j) //erase the A part, keep the B
            mPoints.erase(mPoints.begin());
         return true;
      }
                else if (normA.dot(normB) > .8f || (LongEnough(A) && normA.dot(normB) > .4f))
                {
                        A = A+B; B = C;
                }
                else
                {
                        A = B; B = C;
                }
        }
   
        return false;
}
 
bool JointHitDetector::LongEnough(const ofxVec3f& vec) const
{
   return vec.lengthSquared() > mRequiredLength * mRequiredLength;
}
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