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
00024 class XNV_NITE_API XnVPushDetector :
00025 public XnVPointControl
00026 {
00027 public:
00031 typedef void (XN_CALLBACK_TYPE *PushCB)(XnFloat fVelocity, XnFloat fAngle, void* UserCxt);
00035 typedef void (XN_CALLBACK_TYPE *StabilizedCB)(XnFloat fVelocity, void* UserCxt);
00036
00042 XnVPushDetector(const XnChar* strName = "XnVPushDetector");
00043 ~XnVPushDetector();
00044
00051 void OnPrimaryPointCreate(const XnVHandPointContext* pContext, const XnPoint3D& ptFocus);
00058 void OnPrimaryPointUpdate(const XnVHandPointContext* pContext);
00059
00068 XnCallbackHandle RegisterPush(void* cxt, PushCB pCB);
00077 XnCallbackHandle RegisterStabilized(void* cxt, StabilizedCB pCB);
00078
00084 void UnregisterPush(XnCallbackHandle handle);
00090 void UnregisterStabilized(XnCallbackHandle handle);
00091
00096 XnUInt32 GetPushDuration() const;
00097
00101 void Reset();
00102
00108 XnFloat GetPushImmediateMinimumVelocity() const;
00114 XnUInt32 GetPushImmediateDuration() const;
00120 XnUInt32 GetPushImmediateOffset() const;
00121
00127 XnFloat GetPushPreviousMinimumVelocity() const;
00133 XnUInt32 GetPushPreviousDuration() const;
00139 XnUInt32 GetPushPreviousOffset() const;
00140
00146 XnFloat GetPushMaximumAngleBetweenImmediateAndZ() const;
00152 XnFloat GetPushMinimumAngleBetweenImmediateAndPrevious() const;
00153
00159 XnFloat GetStableMaximumVelocity() const;
00165 XnUInt32 GetStableDuration() const;
00166
00172 void SetPushImmediateMinimumVelocity(XnFloat fVelocity);
00178 void SetPushImmediateDuration(XnUInt32 nDuration);
00184 void SetPushImmediateOffset(XnUInt32 nOffset);
00185
00191 void SetPushPreviousMinimumVelocity(XnFloat fVelocity);
00197 void SetPushPreviousDuration(XnUInt32 nDuration);
00203 void SetPushPreviousOffset(XnUInt32 nOffset);
00204
00210 void SetPushMaximumAngleBetweenImmediateAndZ(XnFloat fAngle);
00216 void SetPushMinimumAngleBetweenImmediateAndPrevious(XnFloat fAngle);
00217
00223 void SetStableMaximumVelocity(XnFloat fVelocity);
00229 void SetStableDuration(XnUInt32 nDuration);
00230 protected:
00231 XnBool IsPushDetected(const XnV3DVector& vImmediateVelocity, const XnV3DVector& vPreviousVelocity, XnFloat& fZAngle);
00232 XnBool IsStabilized(XnFloat fTime, XnFloat& fVelocity);
00233 void UpdateLines(XnFloat fTime);
00234
00235 void AddPoint(const XnPoint3D& pt, XnFloat fTime);
00236
00237 XnFloat AngleBetweenVectors(const XnV3DVector& v1, const XnV3DVector& v2);
00238
00239 XnBool m_bPushDetected;
00240
00241 XnVPointBuffer* m_pPoints;
00242
00243 XnFloat m_fPushImmediateMinVelocity;
00244 XnUInt32 m_nPushImmediateOffset;
00245 XnUInt32 m_nPushImmediateDuration;
00246
00247 XnFloat m_fPushPreviousMinVelocity;
00248 XnUInt32 m_nPushPreviousOffset;
00249 XnUInt32 m_nPushPreviousDuration;
00250
00251 XnFloat m_fPushMaxAngleFromZ;
00252 XnFloat m_fPushMinAngleImmediateAndPrevious;
00253
00254 XnFloat m_fStableMaxVelocity;
00255 XnUInt32 m_nStableDuration;
00256
00257
00258 void PushDetected(XnFloat fVelocity, XnFloat fAngle);
00259 void StabilizedDetected(XnFloat fVelocity);
00260
00261 XnVFloatFloatSpecificEvent m_PushCBs;
00262 XnVFloatSpecificEvent m_StabilizedCBs;
00263 };
00264
00265 #endif // _XNV_PUSH_DETECTOR_H_