All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
MultiTouch::Hand Class Reference

A class that represents a hand. More...

#include <MultiTouch/MultiTouch.hpp>

Public Member Functions

int age () const
 The age of the hand (the number of frames it has been around). More...
 
Nimble::Rectf bounds () const
 The bounding box of this hand. More...
 
Nimble::Rectf bounds (const Nimble::Matrix3 &transform) const
 The bounding box of this hand transformed by the given matrix. More...
 
MultiTouch::Finger findFinger (long id) const
 Finds a finger with a given id. More...
 
MultiTouch::Finger finger (size_t n) const
 Returns the nth finger. More...
 
int fingerCount () const
 Get the number of fingers in the hand. More...
 
 Hand (const __Hand *self=0)
 Constructs a hand. More...
 
TrackedObject::Id id () const
 The unique id for this hand. More...
 
bool isNull () const
 Check if the hand is invalid. More...
 
Nimble::Vector2f motion (float *w=0) const
 Calculates average motion of the fingers. More...
 
Nimble::Vector2f motion (const Nimble::Matrix3 &transform, float *w=0) const
 Calculates the average motion of the fingers in transformed coordinates. More...
 
bool operator< (const Hand &p) const
 Compare the order of hands. More...
 
bool operator== (const Hand &p) const
 Compare hand equality. More...
 
Nimble::Vector2f palmCenter () const
 Estimated palm center location. More...
 
float trackingQuality () const
 Average tracking quality. More...
 
void write (FILE *f) const
 Writes the contents of this hand to the file. More...
 
 ~Hand ()
 Destructor.
 

Static Public Member Functions

static Hand getHand (Finger f)
 Gets the hand from a finger. More...
 

Friends

class TrackedObject
 

Detailed Description

A class that represents a hand.

One should not store these in widgets etc, because this is a proxy object for the actual data laying inside tracker.

Constructor & Destructor Documentation

MultiTouch::Hand::Hand ( const __Hand *  self = 0)
inline

Constructs a hand.

Parameters
selfData to represent with this hand. If none given object will be null.

Member Function Documentation

int MultiTouch::Hand::age ( ) const

The age of the hand (the number of frames it has been around).

Returns
age of the hand in frames
Nimble::Rectf MultiTouch::Hand::bounds ( ) const

The bounding box of this hand.

The bounds include all the fingers belonging to the hand. Useful for doing early-out on interaction culling.

Returns
bounding box of the hand
Nimble::Rectf MultiTouch::Hand::bounds ( const Nimble::Matrix3 transform) const

The bounding box of this hand transformed by the given matrix.

Parameters
transformtransformation matrix
Returns
transformed bounding box of the hand
MultiTouch::Finger MultiTouch::Hand::findFinger ( long  id) const

Finds a finger with a given id.

If the hand does not contain a finger with the given id, then a null finger is returned, see Finger::isNull.

Parameters
idid to look for
Returns
finger with matching id or null Finger if no match found
MultiTouch::Finger MultiTouch::Hand::finger ( size_t  n) const

Returns the nth finger.

Parameters
nindex of the finger
Returns
finger with the given index
int MultiTouch::Hand::fingerCount ( ) const

Get the number of fingers in the hand.

Returns
number of fingers belonging to the hand
static Hand MultiTouch::Hand::getHand ( Finger  f)
static

Gets the hand from a finger.

Parameters
ffinger to query
Returns
hand containing the given finger
TrackedObject::Id MultiTouch::Hand::id ( ) const

The unique id for this hand.

The id counter begins from zero and increases monotonically (unless the hand was generated with Screen::synthesizeFingerInput).

Returns
id of the hand
bool MultiTouch::Hand::isNull ( ) const
inline

Check if the hand is invalid.

Returns
true if the hand is null
Nimble::Vector2f MultiTouch::Hand::motion ( float *  w = 0) const

Calculates average motion of the fingers.

Parameters
wIgnored parameter
Returns
average motion
Nimble::Vector2f MultiTouch::Hand::motion ( const Nimble::Matrix3 transform,
float *  w = 0 
) const

Calculates the average motion of the fingers in transformed coordinates.

Parameters
transformtransformation matrix
wIgnored parameter
Returns
transformed motion
bool MultiTouch::Hand::operator< ( const Hand p) const
inline

Compare the order of hands.

Hands are sorted by their id.

Parameters
phand to compare
Returns
true if id of this is less than p's id
bool MultiTouch::Hand::operator== ( const Hand p) const
inline

Compare hand equality.

Hands are equal if their ids are the same.

Parameters
phand to compare
Returns
true if the hand ids are equal; otherwise false
Nimble::Vector2f MultiTouch::Hand::palmCenter ( ) const

Estimated palm center location.

At the moment the algorithm used is very approximate (and jittery), in the future releases this information will be more reliable.

Returns
estimated palm location
float MultiTouch::Hand::trackingQuality ( ) const

Average tracking quality.

THIS IS NOT USED AT THE MOMENT!

Returns
average tracking quality of fingers
void MultiTouch::Hand::write ( FILE *  f) const

Writes the contents of this hand to the file.

Parameters
fFile to write