Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

XnVSlider1D Class Reference

#include <XnVSlider1D.h>

List of all members.

Public Types

typedef void(XN_CALLBACK_TYPE * ValueChangeCB )(XnFloat fValue, void *cxt)
typedef void(XN_CALLBACK_TYPE * OffAxisMovementCB )(XnVDirection eDir, void *cxt)

Public Member Functions

 XnVSlider1D (XnVAxis eAxis, const XnPoint3D &ptInitialPosition, XnPoint3D ptMinPoint, XnPoint3D ptMaxPoint, XnFloat fMinOutput, XnFloat fMaxOutput, XnFloat fOffAxisDetectionAngle=ms_fOffAxisDefaultDetectionAngle, XnFloat fOffAxisDetectionMinimumVelocity=ms_fDefaultMinimumOffAxisVelocity)
 XnVSlider1D (XnVAxis eAxis, const XnPoint3D &ptInitialPosition, XnFloat fSliderLength, XnFloat fInitialValue, XnFloat fMinOutput, XnFloat fMaxOutput, XnFloat fOffAxisDetectionAngle=ms_fOffAxisDefaultDetectionAngle, XnFloat fOffAxisDetectionMinimumVelocity=ms_fDefaultMinimumOffAxisVelocity)
 ~XnVSlider1D ()
void Reinitialize (XnVAxis eAxis, const XnPoint3D &ptInitialPoint, const XnPoint3D &ptMinPoint, const XnPoint3D &ptMaxPoint, XnFloat fMinOutput, XnFloat fMaxOutput)
void Reinitialize (XnVAxis eAxis, const XnPoint3D &ptInitialPoint, XnFloat fSliderLength, XnFloat fInitialValue, XnFloat fMinOutput, XnFloat fMaxOutput)
XnFloat ValueAtPosition (const XnPoint3D &pt)
XnStatus Update (const XnPoint3D &pt, XnFloat fTime, XnBool bCheckOffAxis=true)
void LostPoint ()
XnCallbackHandle RegisterValueChange (void *cxt, ValueChangeCB CB)
XnCallbackHandle RegisterOffAxisMovement (void *cxt, OffAxisMovementCB CB)
void UnregisterValueChange (XnCallbackHandle hCB)
void UnregisterOffAxisMovement (XnCallbackHandle hCB)
XnFloat GetValue () const
const XnPoint3D & GetPosition () const
XnBool IsValid () const
XnVAxis GetAxis () const
XnFloat GetOffAxisDetectionVelocity () const
XnFloat GetOffAxisDetectionAngle () const
XnUInt32 GetOffAxisDetectionTime () const
void SetOffAxisDetectionVelocity (XnFloat fVelocity)
void SetOffAxisDetectionAngle (XnFloat fAngle)
void SetOffAxisDetectionTime (XnUInt32 nTime)

Protected Member Functions

void ValueChange (XnFloat fValue)
void OffAxisMovement (XnVDirection eDir)
 XnVSlider1D (XnVAxis eAxis, XnBool bDraggable, const XnPoint3D &ptInitialPosition, XnFloat fSliderLength, XnFloat fInitialValue, XnFloat fMinOutput, XnFloat fMaxOutput, XnFloat fOffAxisDetectionAngle=ms_fOffAxisDefaultDetectionAngle, XnFloat fOffAxisDetectionMinimumVelocity=ms_fDefaultMinimumOffAxisVelocity)
void InitializeFromPoint (const XnPoint3D &ptInitialPosition, const XnPoint3D &ptMinPoint, const XnPoint3D &ptMaxPoint, XnBool bVertical, XnFloat &fSliderLength, XnFloat &fInitialValue)
void Initialize (XnVAxis eAxis, XnBool bDraggable, const XnPoint3D &ptInitialPosition, XnFloat fSliderLength, XnFloat fInitialValue, XnFloat fMinOutput, XnFloat fMaxOutput, XnFloat fOffAxisDetectionAngle, XnFloat fOffAxisDetectionMinimumMovement)
XnVDirection CheckForOffAxisMovement (const XnPoint3D &pt, XnFloat fTime)
XnInt32 CheckOffAxis (XnFloat fPrimaryAxisDelta, XnFloat fOffAxisDelta)

Protected Attributes

XnFloat m_fOffAxisDetectionMinimumVelocity
XnFloat m_fOffAxisDetectionAngle
XnUInt32 m_nOffAxisDetectionTime
XnVAxis m_eAxis
XnBool m_bIsDraggable
XnFloat m_fCurrentOutput
XnPoint3D m_ptCurrentPosition
XnFloat m_fOutputMinimum
XnFloat m_fOutputMaximum
XnFloat m_fMaxOutputMajorAxisPosition
XnFloat m_fMinOutputMajorAxisPosition
XnVPointBuffer * m_pPointBuffer
XnVFloatSpecificEvent m_ValueChangeCBs
XnVDirectionSpecificEvent m_OffAxisMovementCBs

Static Protected Attributes

static const XnFloat ms_fDefaultMinimumOffAxisVelocity
static const XnFloat ms_fOffAxisDefaultDetectionAngle
static const XnUInt32 ms_nDefaultTimeForOffAxisDetection

Detailed Description

This is a simple slider. It receives a point, and normalizes it in one (configurable) axis to a number between 0 and 1. It can also recognize movement in its non-primary axis. The XnVSlider1D defines 2 events:

Definition at line 26 of file XnVSlider1D.h.


Member Typedef Documentation

typedef void(XN_CALLBACK_TYPE* XnVSlider1D::OffAxisMovementCB)(XnVDirection eDir, void *cxt)

Type for the off axis movement event callback. It receives a direction of the off-axis movement.

Definition at line 36 of file XnVSlider1D.h.

typedef void(XN_CALLBACK_TYPE* XnVSlider1D::ValueChangeCB)(XnFloat fValue, void *cxt)

Type for the value change event callback. The value is between the slider's minimum and maximum output values.

Definition at line 32 of file XnVSlider1D.h.


Constructor & Destructor Documentation

XnVSlider1D::XnVSlider1D ( XnVAxis  eAxis,
const XnPoint3D &  ptInitialPosition,
XnPoint3D  ptMinPoint,
XnPoint3D  ptMaxPoint,
XnFloat  fMinOutput,
XnFloat  fMaxOutput,
XnFloat  fOffAxisDetectionAngle = ms_fOffAxisDefaultDetectionAngle,
XnFloat  fOffAxisDetectionMinimumVelocity = ms_fDefaultMinimumOffAxisVelocity 
)

Constructor

Parameters:
[in] eAxis The axis of the slider
[in] ptInitialPosition The initial point within the slider
[in] ptMinPoint One edge of the slider
[in] ptMaxPoint Other edge of the slider
[in] fMinOutput Minimum value for slider output
[in] fMaxOutput Maximum value for slider output
[in] fOffAxisDetectionAngle Angle from the slider to consider off-axis
[in] fOffAxisDetectionMinimumVelocity Velocity of off-axis movement to consider off-axis
XnVSlider1D::XnVSlider1D ( XnVAxis  eAxis,
const XnPoint3D &  ptInitialPosition,
XnFloat  fSliderLength,
XnFloat  fInitialValue,
XnFloat  fMinOutput,
XnFloat  fMaxOutput,
XnFloat  fOffAxisDetectionAngle = ms_fOffAxisDefaultDetectionAngle,
XnFloat  fOffAxisDetectionMinimumVelocity = ms_fDefaultMinimumOffAxisVelocity 
)

Constructor

Parameters:
[in] eAxis The axis of the slider
[in] ptInitialPosition The initial point within the slider
[in] fSliderLength The length of the slider
[in] fInitialValue The initial value to consider the initial point
[in] fMinOutput Minimum value for slider output
[in] fMaxOutput Maximum value for slider output
[in] fOffAxisDetectionAngle Angle from the slider to consider off-axis
[in] fOffAxisDetectionMinimumVelocity Velocity of off-axis movement to consider off-axis
XnVSlider1D::~XnVSlider1D (  ) 
XnVSlider1D::XnVSlider1D ( XnVAxis  eAxis,
XnBool  bDraggable,
const XnPoint3D &  ptInitialPosition,
XnFloat  fSliderLength,
XnFloat  fInitialValue,
XnFloat  fMinOutput,
XnFloat  fMaxOutput,
XnFloat  fOffAxisDetectionAngle = ms_fOffAxisDefaultDetectionAngle,
XnFloat  fOffAxisDetectionMinimumVelocity = ms_fDefaultMinimumOffAxisVelocity 
) [protected]

Member Function Documentation

XnVDirection XnVSlider1D::CheckForOffAxisMovement ( const XnPoint3D &  pt,
XnFloat  fTime 
) [protected]
XnInt32 XnVSlider1D::CheckOffAxis ( XnFloat  fPrimaryAxisDelta,
XnFloat  fOffAxisDelta 
) [protected]
XnVAxis XnVSlider1D::GetAxis (  )  const

Get the axis on which the slider works

Returns:
the axis
XnFloat XnVSlider1D::GetOffAxisDetectionAngle (  )  const

Get the minimum angle to consider Off Axis movement

Returns:
The minimum angle to consider Off Axis movement
XnUInt32 XnVSlider1D::GetOffAxisDetectionTime (  )  const

Get the time span in which an off axis movement should be identified

Returns:
The timespan in which an off axis movement should be identified.
XnFloat XnVSlider1D::GetOffAxisDetectionVelocity (  )  const

Get the minimum velocity to consider Off Axis movement

Returns:
The minimum velocity to consider OffAxis movement.
const XnPoint3D& XnVSlider1D::GetPosition (  )  const
XnFloat XnVSlider1D::GetValue (  )  const
void XnVSlider1D::Initialize ( XnVAxis  eAxis,
XnBool  bDraggable,
const XnPoint3D &  ptInitialPosition,
XnFloat  fSliderLength,
XnFloat  fInitialValue,
XnFloat  fMinOutput,
XnFloat  fMaxOutput,
XnFloat  fOffAxisDetectionAngle,
XnFloat  fOffAxisDetectionMinimumMovement 
) [protected]
void XnVSlider1D::InitializeFromPoint ( const XnPoint3D &  ptInitialPosition,
const XnPoint3D &  ptMinPoint,
const XnPoint3D &  ptMaxPoint,
XnBool  bVertical,
XnFloat &  fSliderLength,
XnFloat &  fInitialValue 
) [protected]
XnBool XnVSlider1D::IsValid (  )  const
void XnVSlider1D::LostPoint (  ) 

Restart the search for off axis movement.

void XnVSlider1D::OffAxisMovement ( XnVDirection  eDir  )  [protected]
XnCallbackHandle XnVSlider1D::RegisterOffAxisMovement ( void *  cxt,
OffAxisMovementCB  CB 
)

Register for the off-axis event

Parameters:
[in] cxt User's context
[in] CB The Callback to call when the event is invoked.
Returns:
A handle, to allow unregistration.
XnCallbackHandle XnVSlider1D::RegisterValueChange ( void *  cxt,
ValueChangeCB  CB 
)

Register for the value change event

Parameters:
[in] cxt User's context
[in] CB The Callback to call when the event is invoked.
Returns:
A handle, to allow unregistration.
void XnVSlider1D::Reinitialize ( XnVAxis  eAxis,
const XnPoint3D &  ptInitialPoint,
const XnPoint3D &  ptMinPoint,
const XnPoint3D &  ptMaxPoint,
XnFloat  fMinOutput,
XnFloat  fMaxOutput 
)

Recreate the slider

Parameters:
[in] eAxis The axis of the slider
[in] ptInitialPoint The initial point within the slider
[in] ptMinPoint One edge of the slider
[in] ptMaxPoint Other edge of the slider
[in] fMinOutput Minimum value for slider output
[in] fMaxOutput Maximum value for slider output
void XnVSlider1D::Reinitialize ( XnVAxis  eAxis,
const XnPoint3D &  ptInitialPoint,
XnFloat  fSliderLength,
XnFloat  fInitialValue,
XnFloat  fMinOutput,
XnFloat  fMaxOutput 
)

Recreate the slider

Parameters:
[in] eAxis The axis of the slider
[in] ptInitialPoint The initial point within the slider
[in] fSliderLength The length of the slider
[in] fInitialValue The initial value to consider the initial point
[in] fMinOutput Minimum value for slider output
[in] fMaxOutput Maximum value for slider output
void XnVSlider1D::SetOffAxisDetectionAngle ( XnFloat  fAngle  ) 

Change the minimum angle to consider Off Axis movement, in degrees. Default is 60

Parameters:
[in] fAngle New minimum angle
void XnVSlider1D::SetOffAxisDetectionTime ( XnUInt32  nTime  ) 

Change the time span in which an Off Axis movement should be identified, in milliseconds. Default is 350ms

Parameters:
[in] nTime New time span
void XnVSlider1D::SetOffAxisDetectionVelocity ( XnFloat  fVelocity  ) 

Change the minimum velocity to consider Off Axis movement, in m/s. Default is 0.15m/s

Parameters:
[in] fVelocity New minimum velocity
void XnVSlider1D::UnregisterOffAxisMovement ( XnCallbackHandle  hCB  ) 

Unregister from the off-axis event

Parameters:
[in] hCB The handle provided on registration.
void XnVSlider1D::UnregisterValueChange ( XnCallbackHandle  hCB  ) 

Unregister from the value change event

Parameters:
[in] hCB The handle provided on registration.
XnStatus XnVSlider1D::Update ( const XnPoint3D &  pt,
XnFloat  fTime,
XnBool  bCheckOffAxis = true 
)

The main function. It receives a point, normalizes it, and calculates the new value.

Parameters:
[in] pt The point to check in the slider.
[in] fTime The timestamp (in seconds) of this update
[in] bCheckOffAxis Is the OffAxis event interesting at all?
XnFloat XnVSlider1D::ValueAtPosition ( const XnPoint3D &  pt  ) 

Translation between value and point.

void XnVSlider1D::ValueChange ( XnFloat  fValue  )  [protected]

Member Data Documentation

XnBool XnVSlider1D::m_bIsDraggable [protected]

Definition at line 225 of file XnVSlider1D.h.

Definition at line 224 of file XnVSlider1D.h.

XnFloat XnVSlider1D::m_fCurrentOutput [protected]

Definition at line 227 of file XnVSlider1D.h.

Definition at line 231 of file XnVSlider1D.h.

Definition at line 231 of file XnVSlider1D.h.

Definition at line 221 of file XnVSlider1D.h.

Definition at line 220 of file XnVSlider1D.h.

XnFloat XnVSlider1D::m_fOutputMaximum [protected]

Definition at line 230 of file XnVSlider1D.h.

XnFloat XnVSlider1D::m_fOutputMinimum [protected]

Definition at line 230 of file XnVSlider1D.h.

Definition at line 222 of file XnVSlider1D.h.

XnVDirectionSpecificEvent XnVSlider1D::m_OffAxisMovementCBs [protected]

Definition at line 236 of file XnVSlider1D.h.

XnVPointBuffer* XnVSlider1D::m_pPointBuffer [protected]

Definition at line 233 of file XnVSlider1D.h.

XnPoint3D XnVSlider1D::m_ptCurrentPosition [protected]

Definition at line 228 of file XnVSlider1D.h.

XnVFloatSpecificEvent XnVSlider1D::m_ValueChangeCBs [protected]

Definition at line 235 of file XnVSlider1D.h.

const XnFloat XnVSlider1D::ms_fDefaultMinimumOffAxisVelocity [static, protected]

Definition at line 216 of file XnVSlider1D.h.

const XnFloat XnVSlider1D::ms_fOffAxisDefaultDetectionAngle [static, protected]

Definition at line 217 of file XnVSlider1D.h.

const XnUInt32 XnVSlider1D::ms_nDefaultTimeForOffAxisDetection [static, protected]

Definition at line 218 of file XnVSlider1D.h.


The documentation for this class was generated from the following file: