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 55 56 57 58 | /* * JointHitDetector.h * emptyExample * * Created by Ryan Challinor on 5/17/11. * Copyright 2011 aww bees. All rights reserved. * */ #pragma once #include <ofMain.h> //#include <ofxOpenNI.h> //include "UDPMessenger.h" class JointHitDetector : public IMessageReceiver { public: JointHitDetector(XnSkeletonJoint joint, XnSkeletonJoint refJoint, string name, float requiredLength = 150); ~JointHitDetector(); void Poll(float dt); void Draw() const; void SetJoint(XnSkeletonJoint joint); void OnMessage(const ofxOscMessage& msg); private: enum HitDirection { kHitForward, kHitUp, kHitRight, kHitDown, kHitLeft, kHitBack, kNumHitDirections }; bool DetectHit(ofxVec3f& vDir); bool LongEnough(const ofxVec3f& vec) const; void DrawHitDirection(HitDirection hitDirection) const; bool MatchesDir(const ofxVec3f& vMatchDir, const ofxVec3f& vCheckDir, const ofxVec3f& vRefDir) const; void BroadcastTuningInfo(); bool NeedDistFromRef() const { return mJoint == XN_SKEL_RIGHT_HAND || mJoint == XN_SKEL_LEFT_HAND; } XnSkeletonJoint mJoint; XnSkeletonJoint mRefJoint; std::vector<ofxVec3f> mPoints; float mHitAreaDisplay[kNumHitDirections]; int mPointHistorySize; float mRequiredLength; string mName; float mMessageWorldJointPos; float mMessageBodyJointPos; float mMessageScreenJointPos; }; |
LyoKICogIEpvaW50SGl0RGV0ZWN0b3IuaAogKiAgZW1wdHlFeGFtcGxlCiAqCiAqICBDcmVhdGVkIGJ5IFJ5YW4gQ2hhbGxpbm9yIG9uIDUvMTcvMTEuCiAqICBDb3B5cmlnaHQgMjAxMSBhd3cgYmVlcy4gQWxsIHJpZ2h0cyByZXNlcnZlZC4KICoKICovCgojcHJhZ21hIG9uY2UKCiNpbmNsdWRlIDxvZk1haW4uaD4KLy8jaW5jbHVkZSA8b2Z4T3Blbk5JLmg+Ci8v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gTmVlZERpc3RGcm9tUmVmKCkgY29uc3QgeyByZXR1cm4gbUpvaW50ID09IFhOX1NLRUxfUklHSFRfSEFORCB8fCBtSm9pbnQgPT0gWE5fU0tFTF9MRUZUX0hBTkQ7IH0KICAgCiAgIFhuU2tlbGV0b25Kb2ludCBtSm9pbnQ7CiAgIFhuU2tlbGV0b25Kb2ludCBtUmVmSm9pbnQ7CiAgIHN0ZDo6dmVjdG9yPG9meFZlYzNmPiBtUG9pbnRzOwogICBmbG9hdCBtSGl0QXJlYURpc3BsYXlba051bUhpdERpcmVjdGlvbnNdOwogICBpbnQgbVBvaW50SGlzdG9yeVNpemU7CiAgIGZsb2F0IG1SZXF1aXJlZExlbmd0aDsKICAgc3RyaW5nIG1OYW1lOwogICBmbG9hdCBtTWVzc2FnZVdvcmxkSm9pbnRQb3M7CiAgIGZsb2F0IG1NZXNzYWdlQm9keUpvaW50UG9zOwogICBmbG9hdCBtTWVzc2FnZVNjcmVlbkpvaW50UG9zOwp9Owo=
prog.cpp:10:9: warning: #pragma once in main file
prog.cpp:12:20: error: ofMain.h: No such file or directory
prog.cpp:17: error: expected class-name before ‘{’ token
prog.cpp:19: error: expected `)' before ‘joint’
prog.cpp:25: error: ‘XnSkeletonJoint’ has not been declared
prog.cpp:26: error: expected ‘,’ or ‘...’ before ‘&’ token
prog.cpp:26: error: ISO C++ forbids declaration of ‘ofxOscMessage’ with no type
prog.cpp:40: error: ‘ofxVec3f’ has not been declared
prog.cpp:41: error: expected ‘,’ or ‘...’ before ‘&’ token
prog.cpp:41: error: ISO C++ forbids declaration of ‘ofxVec3f’ with no type
prog.cpp:43: error: expected ‘,’ or ‘...’ before ‘&’ token
prog.cpp:43: error: ISO C++ forbids declaration of ‘ofxVec3f’ with no type
prog.cpp:47: error: ‘XnSkeletonJoint’ does not name a type
prog.cpp:48: error: ‘XnSkeletonJoint’ does not name a type
prog.cpp:49: error: ISO C++ forbids declaration of ‘vector’ with no type
prog.cpp:49: error: invalid use of ‘::’
prog.cpp:49: error: expected ‘;’ before ‘<’ token
prog.cpp:53: error: ‘string’ does not name a type
prog.cpp: In member function ‘bool JointHitDetector::NeedDistFromRef() const’:
prog.cpp:45: error: ‘mJoint’ was not declared in this scope
prog.cpp:45: error: ‘XN_SKEL_RIGHT_HAND’ was not declared in this scope
prog.cpp:45: error: ‘XN_SKEL_LEFT_HAND’ was not declared in this scope
-
result: Compilation error (maybe you wish to see an example for C++ 4.7.2)


