SOFA plugin: LeapMotion  master
Open source framework for multi-physics simuation
Leap::Tool Class Reference

#include <Leap.h>

Inheritance diagram for Leap::Tool:

Detailed Description

The Tool class represents a tracked tool.

Tools are Pointable objects that the Leap has classified as a tool. Tools are longer, thinner, and straighter than a typical finger. Get valid Tool objects from a Frame or a Hand object.

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

Public Member Functions

 Tool (ToolImplementation *)
 
LEAP_EXPORT Tool ()
 
LEAP_EXPORT Tool (const Pointable &)
 
LEAP_EXPORT std::string toString () const
 
- Public Member Functions inherited from Leap::Pointable
 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 Toolinvalid ()
 
- Static Public Member Functions inherited from Leap::Pointable
static LEAP_EXPORT const Pointableinvalid ()
 

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

◆ Tool() [1/3]

Leap::Tool::Tool ( ToolImplementation *  )

◆ Tool() [2/3]

LEAP_EXPORT Leap::Tool::Tool ( )

Constructs a Tool object.

An uninitialized tool is considered invalid. Get valid Tool objects from a Frame or a Hand object.

◆ Tool() [3/3]

LEAP_EXPORT Leap::Tool::Tool ( const Pointable )
explicit

If the specified Pointable object represents a tool, creates a copy of it as a Tool object; otherwise, creates an invalid Tool object.

Function details

◆ invalid()

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

Returns an invalid Tool object.

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

Returns
The invalid Tool instance.

◆ toString()

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

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

Returns
A description of the Tool object as a string.