SOFA plugin: LeapMotion  master
Open source framework for multi-physics simuation
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Leap::Pointable Class Reference

#include <Leap.h>

Inheritance diagram for Leap::Pointable:

Detailed Description

The Pointable class reports the physical characteristics of a detected finger or tool.

Both fingers and tools are classified as Pointable objects. Use the Pointable::isFinger() function to determine whether a Pointable object represents a finger. Use the Pointable::isTool() function to determine whether a Pointable object represents a tool. The Leap classifies a detected entity as a tool when it is thinner, straighter, and longer than a typical finger.

Note that Pointable objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical entity. Invalid Pointable objects can be the result of asking for a Pointable object using an ID from an earlier frame when no Pointable objects with that ID exist in the current frame. A Pointable object created from the Pointable constructor is also invalid. Test for validity with the Pointable::isValid() function.

Public Member Functions

 Pointable (PointableImplementation *)
 
 Pointable (FingerImplementation *)
 
 Pointable (ToolImplementation *)
 
LEAP_EXPORT Pointable ()
 
LEAP_EXPORT int32_t id () const
 
LEAP_EXPORT Frame frame () const
 
LEAP_EXPORT Hand hand () const
 
LEAP_EXPORT Vector tipPosition () const
 
LEAP_EXPORT Vector tipVelocity () const
 
LEAP_EXPORT Vector direction () const
 
LEAP_EXPORT float width () const
 
LEAP_EXPORT float length () const
 
LEAP_EXPORT bool isFinger () const
 
LEAP_EXPORT bool isTool () const
 
LEAP_EXPORT bool isValid () const
 
LEAP_EXPORT bool operator== (const Pointable &) const
 
LEAP_EXPORT bool operator!= (const Pointable &) const
 
LEAP_EXPORT std::string toString () const
 

Static Public Member Functions

static LEAP_EXPORT const Pointableinvalid ()
 

Friends

LEAP_EXPORT friend std::ostream & operator<< (std::ostream &, const Pointable &)
 

Additional Inherited Members

- Protected Attributes inherited from Leap::Interface
class SharedObject * m_object
 
- Protected Member Functions inherited from Leap::Interface
LEAP_EXPORT Interface (void *owner)
 
LEAP_EXPORT Interface (Implementation *reference, void *owner)
 
LEAP_EXPORT Interface (const Interface &rhs)
 
LEAP_EXPORT Interfaceoperator= (const Interface &rhs)
 
virtual LEAP_EXPORT ~Interface ()
 
template<typename T >
T * get () const
 

Constructor details

◆ Pointable() [1/4]

Leap::Pointable::Pointable ( PointableImplementation *  )

◆ Pointable() [2/4]

Leap::Pointable::Pointable ( FingerImplementation *  )

◆ Pointable() [3/4]

Leap::Pointable::Pointable ( ToolImplementation *  )

◆ Pointable() [4/4]

LEAP_EXPORT Leap::Pointable::Pointable ( )

Constructs a Pointable object.

An uninitialized pointable is considered invalid. Get valid Pointable objects from a Frame or a Hand object.

Function details

◆ direction()

LEAP_EXPORT Vector Leap::Pointable::direction ( ) const

The direction in which this finger or tool is pointing.

The direction is expressed as a unit vector pointing in the same direction as the tip.

Returns
The Vector pointing in the same direction as the tip of this Pointable object.

◆ frame()

LEAP_EXPORT Frame Leap::Pointable::frame ( ) const

The Frame associated with this Pointable object.

Returns
The associated Frame object, if available; otherwise, an invalid Frame object is returned.

◆ hand()

LEAP_EXPORT Hand Leap::Pointable::hand ( ) const

The Hand associated with this finger or tool.

Returns
The associated Hand object, if available; otherwise, an invalid Hand object is returned.

◆ id()

LEAP_EXPORT int32_t Leap::Pointable::id ( ) const

A unique ID assigned to this Pointable object, whose value remains the same across consecutive frames while the tracked finger or tool remains visible. If tracking is lost (for example, when a finger is occluded by another finger or when it is withdrawn from the Leap field of view), the Leap may assign a new ID when it detects the entity in a future frame.

Use the ID value with the Frame::pointable() function to find this Pointable object in future frames.

Returns
The ID assigned to this Pointable object.

◆ invalid()

static LEAP_EXPORT const Pointable& Leap::Pointable::invalid ( )
static

Returns an invalid Pointable object.

You can use the instance returned by this function in comparisons testing whether a given Pointable instance is valid or invalid. (You can also use the Pointable::isValid() function.)

Returns
The invalid Pointable instance.

◆ isFinger()

LEAP_EXPORT bool Leap::Pointable::isFinger ( ) const

Whether or not the Pointable is believed to be a finger. Fingers are generally shorter, thicker, and less straight than tools.

Returns
True, if this Pointable is classified as a finger.

◆ isTool()

LEAP_EXPORT bool Leap::Pointable::isTool ( ) const

Whether or not the Pointable is believed to be a tool. Tools are generally longer, thinner, and straighter than fingers.

Returns
True, if this Pointable is classified as a tool.

◆ isValid()

LEAP_EXPORT bool Leap::Pointable::isValid ( ) const

Reports whether this is a valid Pointable object.

Returns
True, if this Pointable object contains valid tracking data.

◆ length()

LEAP_EXPORT float Leap::Pointable::length ( ) const

The estimated length of the finger or tool in millimeters.

The reported length is the visible length of the finger or tool from the hand to tip. If the length isn't known, then a value of 0 is returned.

Returns
The estimated length of this Pointable object.

◆ operator!=()

LEAP_EXPORT bool Leap::Pointable::operator!= ( const Pointable ) const

Compare Pointable object inequality. Two Pointable objects are equal if and only if both Pointable objects represent the exact same physical entities in the same frame and both Pointable objects are valid.

◆ operator==()

LEAP_EXPORT bool Leap::Pointable::operator== ( const Pointable ) const

Compare Pointable object equality. Two Pointable objects are equal if and only if both Pointable objects represent the exact same physical entities in the same frame and both Pointable objects are valid.

◆ tipPosition()

LEAP_EXPORT Vector Leap::Pointable::tipPosition ( ) const

The tip position in millimeters from the Leap origin.

Returns
The Vector containing the coordinates of the tip position.

◆ tipVelocity()

LEAP_EXPORT Vector Leap::Pointable::tipVelocity ( ) const

The rate of change of the tip position in millimeters/second.

Returns
The Vector containing the coordinates of the tip velocity.

◆ toString()

LEAP_EXPORT std::string Leap::Pointable::toString ( ) const

A string containing a brief, human readable description of the Pointable object.

Returns
A description of the Pointable object as a string.

◆ width()

LEAP_EXPORT float Leap::Pointable::width ( ) const

The estimated width of the finger or tool in millimeters.

The reported width is the average width of the visible portion of the finger or tool from the hand to the tip. If the width isn't known, then a value of 0 is returned.

Returns
The estimated width of this Pointable object.

Related details

◆ operator<<

LEAP_EXPORT friend std::ostream& operator<< ( std::ostream &  ,
const Pointable  
)
friend

Writes a brief, human readable description of the Pointable object to an output stream.