Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _XNV_PUSH_DETECTOR_H_
00010 #define _XNV_PUSH_DETECTOR_H_
00011
00012 #include "XnVNiteDefs.h"
00013 #include "XnVPointControl.h"
00014 #include "XnV3DVector.h"
00015
00016 class XnVPointBuffer;
00017 class XnVFloatFloatSpecificEvent;
00018 class XnVFloatSpecificEvent;
00025 class XNV_NITE_API XnVPushDetector :
00026 public XnVPointControl
00027 {
00028 public:
00032 typedef void (XN_CALLBACK_TYPE *PushCB)(XnFloat fVelocity, XnFloat fAngle, void* UserCxt);
00036 typedef void (XN_CALLBACK_TYPE *StabilizedCB)(XnFloat fVelocity, void* UserCxt);
00037
00043 XnVPushDetector(const XnChar* strName = "XnVPushDetector");
00044 ~XnVPushDetector();
00045
00052 void OnPrimaryPointCreate(const XnVHandPointContext* pContext, const XnPoint3D& ptFocus);
00059 void OnPrimaryPointUpdate(const XnVHandPointContext* pContext);
00060
00069 XnCallbackHandle RegisterPush(void* cxt, PushCB pCB);
00078 XnCallbackHandle RegisterStabilized(void* cxt, StabilizedCB pCB);
00079
00085 void UnregisterPush(XnCallbackHandle handle);
00091 void UnregisterStabilized(XnCallbackHandle handle);
00092
00097 XnUInt32 GetPushDuration() const;
00098
00102 void Reset();
00103
00109 XnFloat GetPushImmediateMinimumVelocity() const;
00115 XnUInt32 GetPushImmediateDuration() const;
00121 XnUInt32 GetPushImmediateOffset() const;
00122
00128 XnFloat GetPushPreviousMinimumVelocity() const;
00134 XnUInt32 GetPushPreviousDuration() const;
00140 XnUInt32 GetPushPreviousOffset() const;
00141
00147 XnFloat GetPushMaximumAngleBetweenImmediateAndZ() const;
00153 XnFloat GetPushMinimumAngleBetweenImmediateAndPrevious() const;
00154
00160 XnFloat GetStableMaximumVelocity() const;
00166 XnUInt32 GetStableDuration() const;
00167
00173 void SetPushImmediateMinimumVelocity(XnFloat fVelocity);
00179 void SetPushImmediateDuration(XnUInt32 nDuration);
00185 void SetPushImmediateOffset(XnUInt32 nOffset);
00186
00192 void SetPushPreviousMinimumVelocity(XnFloat fVelocity);
00198 void SetPushPreviousDuration(XnUInt32 nDuration);
00204 void SetPushPreviousOffset(XnUInt32 nOffset);
00205
00211 void SetPushMaximumAngleBetweenImmediateAndZ(XnFloat fAngle);
00217 void SetPushMinimumAngleBetweenImmediateAndPrevious(XnFloat fAngle);
00218
00224 void SetStableMaximumVelocity(XnFloat fVelocity);
00230 void SetStableDuration(XnUInt32 nDuration);
00231 protected:
00232 XnBool IsPushDetected(const XnV3DVector& vImmediateVelocity, const XnV3DVector& vPreviousVelocity, XnFloat& fZAngle);
00233 XnBool IsStabilized(XnFloat fTime, XnFloat& fVelocity);
00234 void UpdateLines(XnFloat fTime);
00235
00236 void AddPoint(const XnPoint3D& pt, XnFloat fTime);
00237
00238 XnFloat AngleBetweenVectors(const XnV3DVector& v1, const XnV3DVector& v2);
00239
00240 XnBool m_bPushDetected;
00241
00242 XnVPointBuffer* m_pPoints;
00243
00244 XnFloat m_fPushImmediateMinVelocity;
00245 XnUInt32 m_nPushImmediateOffset;
00246 XnUInt32 m_nPushImmediateDuration;
00247
00248 XnFloat m_fPushPreviousMinVelocity;
00249 XnUInt32 m_nPushPreviousOffset;
00250 XnUInt32 m_nPushPreviousDuration;
00251
00252 XnFloat m_fPushMaxAngleFromZ;
00253 XnFloat m_fPushMinAngleImmediateAndPrevious;
00254
00255 XnFloat m_fStableMaxVelocity;
00256 XnUInt32 m_nStableDuration;
00257
00258
00259 void PushDetected(XnFloat fVelocity, XnFloat fAngle);
00260 void StabilizedDetected(XnFloat fVelocity);
00261
00262 XnVFloatFloatSpecificEvent* m_pPushCBs;
00263 XnVFloatSpecificEvent* m_pStabilizedCBs;
00264 };
00265
00266 #endif // _XNV_PUSH_DETECTOR_H_