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

This class represents all different objects that can be tracked by Cornerstone, like fingers, hands, pens, and markers. More...

#include <MultiTouch/MultiTouch.hpp>

Public Types

typedef long Id
 Object Id type.
 

Public Member Functions

int age () const
 Get the age of the tracked object. More...
 
Finger asFinger () const
 Convert the tracked object to a finger. More...
 
Hand asHand () const
 Convert the tracked object to a hand. More...
 
Marker asMarker () const
 Convert the tracked object to a marker. More...
 
Pen asPen () const
 Convert the tracked object to a pen. More...
 
Id id () const
 Get the unique id of the tracked object. More...
 
Nimble::Vector2 initLocation () const
 The initial location of this object. More...
 
bool isNull () const
 Check if the tracked object is null. More...
 
bool isVirtual () const
 Check if the object is a virtual object. More...
 
Nimble::Vector2 location () const
 Get the location of the tracked object. More...
 
bool operator< (const TrackedObject &p) const
 Compare the order of tracked objects. More...
 
bool operator== (const TrackedObject &p) const
 Compare tracked objects for equality. More...
 
 TrackedObject ()
 Constructs an empty tracked object. isNull returns true for this object.
 
 TrackedObject (const TrackedData *td)
 Constuct a tracked object given the data. More...
 
 TrackedObject (Finger f)
 Construct a tracked object from the given finger. More...
 
 TrackedObject (Hand h)
 Construct a tracked object from the given hand. More...
 
 TrackedObject (Pen p)
 Construct a tracked object from the given pen. More...
 
 TrackedObject (Marker p)
 Construct a tracked object from the given marker. More...
 
TrackedObjectType type () const
 Get the type of the tracked object. More...
 

Detailed Description

This class represents all different objects that can be tracked by Cornerstone, like fingers, hands, pens, and markers.

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::TrackedObject::TrackedObject ( const TrackedData *  td)

Constuct a tracked object given the data.

The data is not freed when the tracked object instance is destroyed.

Parameters
tdtracked object data
MultiTouch::TrackedObject::TrackedObject ( Finger  f)

Construct a tracked object from the given finger.

Parameters
ffinger data
MultiTouch::TrackedObject::TrackedObject ( Hand  h)

Construct a tracked object from the given hand.

Parameters
hhand data
MultiTouch::TrackedObject::TrackedObject ( Pen  p)

Construct a tracked object from the given pen.

Parameters
ppen data
MultiTouch::TrackedObject::TrackedObject ( Marker  p)

Construct a tracked object from the given marker.

Parameters
pmarker data

Member Function Documentation

int MultiTouch::TrackedObject::age ( ) const

Get the age of the tracked object.

Returns the number of input samples the object has been tracked.

Returns
age of the object in samples
Finger MultiTouch::TrackedObject::asFinger ( ) const

Convert the tracked object to a finger.

Finger object returned is null if the object type is not finger.

See Also
Finger::isNull
Returns
finger representing the tracked object
Hand MultiTouch::TrackedObject::asHand ( ) const

Convert the tracked object to a hand.

hand object returned is null if the object type is not hand.

See Also
Hand::isNull
Returns
hand representing the tracked object
Marker MultiTouch::TrackedObject::asMarker ( ) const

Convert the tracked object to a marker.

Marker object returned is null if the object type is not marker.

See Also
Marker::isNull
Returns
marker representing the tracked object
Pen MultiTouch::TrackedObject::asPen ( ) const

Convert the tracked object to a pen.

Pen object returned is null if the object type is not pen.

See Also
Pen::isNull
Returns
pen representing the tracked object
Id MultiTouch::TrackedObject::id ( ) const

Get the unique id of the tracked object.

Returns
id of the tracked object
Nimble::Vector2 MultiTouch::TrackedObject::initLocation ( ) const

The initial location of this object.

This function returns the initial location where the object was first detected. At the moment this is only valid for Finger objects, and other object types return the "location" value.

Returns
initial object location
bool MultiTouch::TrackedObject::isNull ( ) const

Check if the tracked object is null.

Null objects are objects that have a nullptr as data.

Returns
true if the object is null; otherwise false
bool MultiTouch::TrackedObject::isVirtual ( ) const

Check if the object is a virtual object.

Virtual objects are generated manually by the user and not by the tracker.

Returns
true if the object was generated by the user; otherwise false
Nimble::Vector2 MultiTouch::TrackedObject::location ( ) const

Get the location of the tracked object.

Returns
object location
bool MultiTouch::TrackedObject::operator< ( const TrackedObject p) const
inline

Compare the order of tracked objects.

Comparison is done using ids.

Parameters
pobject to compare
Returns
true if the id of this is smaller than the id of p
bool MultiTouch::TrackedObject::operator== ( const TrackedObject p) const
inline

Compare tracked objects for equality.

Objects are equal if their ids are the same.

Parameters
pobject to compare
Returns
true if the object ids are equal; otherwise false
TrackedObjectType MultiTouch::TrackedObject::type ( ) const

Get the type of the tracked object.

Returns
type of the tracked object