Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes | List of all members
Leap::Gesture Class Reference

#include <Leap.h>

Inheritance diagram for Leap::Gesture:
Inheritance graph
[legend]

Public Types

enum  State { STATE_INVALID = -1, STATE_START = 1, STATE_UPDATE = 2, STATE_STOP = 3 }
 
enum  Type {
  TYPE_INVALID = -1, TYPE_SWIPE = 1, TYPE_CIRCLE = 4, TYPE_SCREEN_TAP = 5,
  TYPE_KEY_TAP = 6
}
 

Public Member Functions

def __eq__ (self, rhs)
 
def __init__ (self, args)
 
def __ne__ (self, rhs)
 
def __str__ (self)
 
LEAP_EXPORT int64_t duration () const
 
LEAP_EXPORT float durationSeconds () const
 
LEAP_EXPORT Frame frame () const
 
 Gesture (GestureImplementation *)
 
LEAP_EXPORT Gesture ()
 
LEAP_EXPORT Gesture (const Gesture &rhs)
 
LEAP_EXPORT HandList hands () const
 
LEAP_EXPORT int32_t id () const
 
LEAP_EXPORT bool isValid () const
 
LEAP_EXPORT bool operator!= (const Gesture &rhs) const
 
LEAP_EXPORT bool operator== (const Gesture &rhs) const
 
LEAP_EXPORT PointableList pointables () const
 
LEAP_EXPORT State state () const
 
std::string toString () const
 
LEAP_EXPORT Type type () const
 
- Public Member Functions inherited from Leap::Interface
def __init__ (self, args, kwargs)
 

Static Public Member Functions

static LEAP_EXPORT const Gestureinvalid ()
 

Public Attributes

 this
 

Static Public Attributes

 duration = _swig_property(LeapPython.Gesture_duration_get)
 
 duration_seconds = _swig_property(LeapPython.Gesture_duration_seconds_get)
 
 frame = _swig_property(LeapPython.Gesture_frame_get)
 
 hands = _swig_property(LeapPython.Gesture_hands_get)
 
 id = _swig_property(LeapPython.Gesture_id_get)
 
 is_valid = _swig_property(LeapPython.Gesture_is_valid_get)
 
 pointables = _swig_property(LeapPython.Gesture_pointables_get)
 
 state = _swig_property(LeapPython.Gesture_state_get)
 
 STATE_INVALID = LeapPython.Gesture_STATE_INVALID
 
 STATE_START = LeapPython.Gesture_STATE_START
 
 STATE_STOP = LeapPython.Gesture_STATE_STOP
 
 STATE_UPDATE = LeapPython.Gesture_STATE_UPDATE
 
 type = _swig_property(LeapPython.Gesture_type_get)
 
 TYPE_CIRCLE = LeapPython.Gesture_TYPE_CIRCLE
 
 TYPE_INVALID = LeapPython.Gesture_TYPE_INVALID
 
 TYPE_KEY_TAP = LeapPython.Gesture_TYPE_KEY_TAP
 
 TYPE_SCREEN_TAP = LeapPython.Gesture_TYPE_SCREEN_TAP
 
 TYPE_SWIPE = LeapPython.Gesture_TYPE_SWIPE
 

Private Member Functions

LEAP_EXPORT const char * toCString () const
 

Static Private Attributes

 __getattr__ = lambdaself,name:_swig_getattr(self, Gesture, name)
 
 __repr__ = _swig_repr
 
 __setattr__ = lambdaself,name,value:_swig_setattr(self, Gesture, name, value)
 
 __swig_destroy__ = LeapPython.delete_Gesture
 
dictionary __swig_getmethods__ = {}
 
dictionary __swig_setmethods__ = {}
 

Additional Inherited Members

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

Detailed Description

The Gesture class represents a recognized movement by the user.

The Leap Motion Controller watches the activity within its field of view for certain movement patterns typical of a user gesture or command. For example, a movement from side to side with the hand can indicate a swipe gesture, while a finger poking forward can indicate a screen tap gesture.

When the Leap Motion software recognizes a gesture, it assigns an ID and adds a Gesture object to the frame gesture list. For continuous gestures, which occur over many frames, the Leap Motion software updates the gesture by adding a Gesture object having the same ID and updated properties in each subsequent frame.

Important: Recognition for each type of gesture must be enabled using the Controller::enableGesture() function; otherwise no gestures are recognized or reported.

Subclasses of Gesture define the properties for the specific movement patterns recognized by the Leap Motion software.

The Gesture subclasses include:

CircleGesture – A circular movement by a finger.

SwipeGesture – A straight line movement by the hand with fingers extended.

ScreenTapGesture – A forward tapping movement by a finger.

KeyTapGesture – A downward tapping movement by a finger.

Circle and swipe gestures are continuous and these objects can have a state of start, update, and stop.

The screen tap gesture is a discrete gesture. The Leap Motion software only creates a single ScreenTapGesture object for each tap and it always has a stop state.

Get valid Gesture instances from a Frame object. You can get a list of gestures with the Frame::gestures() method. You can get a list of gestures since a specified frame with the Frame::gestures(const Frame&) method. You can also use the Frame::gesture() method to find a gesture in the current frame using an ID value obtained in a previous frame.

Gesture objects can be invalid. For example, when you get a gesture by ID using Frame::gesture(), and there is no gesture with that ID in the current frame, then gesture() returns an Invalid Gesture object (rather than a null value). Always check object validity in situations where a gesture might be invalid.

The following keys can be used with the Config class to configure the gesture recognizer:

==================================== ========== ============= ======= Key string Value type Default value Units ==================================== ========== ============= ======= Gesture.Circle.MinRadius float 5.0 mm Gesture.Circle.MinArc float 1.5 * pi radians Gesture.Swipe.MinLength float 150 mm Gesture.Swipe.MinVelocity float 1000 mm/s Gesture.KeyTap.MinDownVelocity float 50 mm/s Gesture.KeyTap.HistorySeconds float 0.1 s Gesture.KeyTap.MinDistance float 3.0 mm Gesture.ScreenTap.MinForwardVelocity float 50 mm/s Gesture.ScreenTap.HistorySeconds float 0.1 s Gesture.ScreenTap.MinDistance float 5.0 mm ==================================== ========== ============= =======

Since
1.0

Definition at line 1812 of file Leap.h.

Member Enumeration Documentation

The possible gesture states.

Since
1.0
Enumerator
STATE_INVALID 

An invalid state

Since
1.0
STATE_START 

The gesture is starting. Just enough has happened to recognize it.

Since
1.0
STATE_UPDATE 

The gesture is in progress. (Note: not all gestures have updates).

Since
1.0
STATE_STOP 

The gesture has completed or stopped.

Since
1.0

Definition at line 1861 of file Leap.h.

The supported types of gestures.

Since
1.0
Enumerator
TYPE_INVALID 

An invalid type.

Since
1.0
TYPE_SWIPE 

A straight line movement by the hand with fingers extended.

Since
1.0
TYPE_CIRCLE 

A circular movement by a finger.

Since
1.0
TYPE_SCREEN_TAP 

A forward tapping movement by a finger.

Since
1.0
TYPE_KEY_TAP 

A downward tapping movement by a finger.

Since
1.0

Definition at line 1821 of file Leap.h.

Constructor & Destructor Documentation

Leap::Gesture::Gesture ( GestureImplementation *  )
LEAP_EXPORT Leap::Gesture::Gesture ( )

Constructs a new Gesture object.

An uninitialized Gesture object is considered invalid. Get valid instances of the Gesture class, which will be one of the Gesture subclasses, from a Frame object.

Since
1.0
LEAP_EXPORT Leap::Gesture::Gesture ( const Gesture rhs)

Constructs a new copy of an Gesture object.

Since
1.0
def Leap.Gesture.__init__ (   self,
  args 
)

Definition at line 862 of file Leap.py.

Member Function Documentation

def Leap.Gesture.__eq__ (   self,
  rhs 
)

Definition at line 869 of file Leap.py.

def Leap.Gesture.__ne__ (   self,
  rhs 
)

Definition at line 872 of file Leap.py.

def Leap.Gesture.__str__ (   self)

Definition at line 875 of file Leap.py.

LEAP_EXPORT int64_t Leap::Gesture::duration ( ) const

The elapsed duration of the recognized movement up to the frame containing this Gesture object, in microseconds.

The duration reported for the first Gesture in the sequence (with the STATE_START state) will typically be a small positive number since the movement must progress far enough for the Leap Motion software to recognize it as an intentional gesture.

Returns
int64_t the elapsed duration in microseconds.
Since
1.0
LEAP_EXPORT float Leap::Gesture::durationSeconds ( ) const

The elapsed duration in seconds.

See also
duration()
Returns
float the elapsed duration in seconds.
Since
1.0
LEAP_EXPORT Frame Leap::Gesture::frame ( ) const

The Frame containing this Gesture instance.

_

Returns
Frame The parent Frame object.
Since
1.0
LEAP_EXPORT HandList Leap::Gesture::hands ( ) const

The list of hands associated with this Gesture, if any.

If no hands are related to this gesture, the list is empty.

Returns
HandList the list of related Hand objects.
Since
1.0
LEAP_EXPORT int32_t Leap::Gesture::id ( ) const

The gesture ID.

All Gesture objects belonging to the same recognized movement share the same ID value. Use the ID value with the Frame::gesture() method to find updates related to this Gesture object in subsequent frames.

Returns
int32_t the ID of this Gesture.
Since
1.0
static LEAP_EXPORT const Gesture& Leap::Gesture::invalid ( )
static

Returns an invalid Gesture object.

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

Returns
The invalid Gesture instance.
Since
1.0
LEAP_EXPORT bool Leap::Gesture::isValid ( ) const

Reports whether this Gesture instance represents a valid Gesture.

An invalid Gesture object does not represent a snapshot of a recognized movement. Invalid Gesture objects are returned when a valid object cannot be provided. For example, when you get an gesture by ID using Frame::gesture(), and there is no gesture with that ID in the current frame, then gesture() returns an Invalid Gesture object (rather than a null value). Always check object validity in situations where an gesture might be invalid.

Returns
bool True, if this is a valid Gesture instance; false, otherwise.
Since
1.0
LEAP_EXPORT bool Leap::Gesture::operator!= ( const Gesture rhs) const

Compare Gesture object inequality.

Two Gestures are equal only if they represent the same snapshot of the same recognized movement.

Since
1.0
LEAP_EXPORT bool Leap::Gesture::operator== ( const Gesture rhs) const

Compare Gesture object equality.

Two Gestures are equal if they represent the same snapshot of the same recognized movement.

Since
1.0
LEAP_EXPORT PointableList Leap::Gesture::pointables ( ) const

The list of fingers and tools associated with this Gesture, if any.

If no Pointable objects are related to this gesture, the list is empty.

Returns
PointableList the list of related Pointable objects.
Since
1.0
LEAP_EXPORT State Leap::Gesture::state ( ) const

The gesture state.

Recognized movements occur over time and have a beginning, a middle, and an end. The 'state()' attribute reports where in that sequence this Gesture object falls.

Returns
Gesture::State A value from the Gesture::State enumeration.
Since
1.0
LEAP_EXPORT const char* Leap::Gesture::toCString ( ) const
private
std::string Leap::Gesture::toString ( ) const
inline

A string containing a brief, human-readable description of this Gesture.

Since
1.0

Definition at line 2057 of file Leap.h.

LEAP_EXPORT Type Leap::Gesture::type ( ) const

The gesture type.

Returns
Gesture::Type A value from the Gesture::Type enumeration.
Since
1.0

Member Data Documentation

Leap.Gesture.__getattr__ = lambdaself,name:_swig_getattr(self, Gesture, name)
staticprivate

Definition at line 850 of file Leap.py.

Leap.Gesture.__repr__ = _swig_repr
staticprivate

Definition at line 851 of file Leap.py.

Leap.Gesture.__setattr__ = lambdaself,name,value:_swig_setattr(self, Gesture, name, value)
staticprivate

Definition at line 846 of file Leap.py.

Leap.Gesture.__swig_destroy__ = LeapPython.delete_Gesture
staticprivate

Definition at line 904 of file Leap.py.

dictionary Leap.Gesture.__swig_getmethods__ = {}
staticprivate

Definition at line 847 of file Leap.py.

dictionary Leap.Gesture.__swig_setmethods__ = {}
staticprivate

Definition at line 843 of file Leap.py.

Leap.Gesture.duration = _swig_property(LeapPython.Gesture_duration_get)
static

Definition at line 888 of file Leap.py.

Leap.Gesture.duration_seconds = _swig_property(LeapPython.Gesture_duration_seconds_get)
static

Definition at line 891 of file Leap.py.

Leap.Gesture.frame = _swig_property(LeapPython.Gesture_frame_get)
static

Definition at line 894 of file Leap.py.

Leap.Gesture.hands = _swig_property(LeapPython.Gesture_hands_get)
static

Definition at line 897 of file Leap.py.

Leap.Gesture.id = _swig_property(LeapPython.Gesture_id_get)
static

Definition at line 885 of file Leap.py.

Leap.Gesture.is_valid = _swig_property(LeapPython.Gesture_is_valid_get)
static

Definition at line 903 of file Leap.py.

Leap.Gesture.pointables = _swig_property(LeapPython.Gesture_pointables_get)
static

Definition at line 900 of file Leap.py.

Leap.Gesture.state = _swig_property(LeapPython.Gesture_state_get)
static

Definition at line 882 of file Leap.py.

Leap.Gesture.STATE_INVALID = LeapPython.Gesture_STATE_INVALID
static

Definition at line 857 of file Leap.py.

Leap.Gesture.STATE_START = LeapPython.Gesture_STATE_START
static

Definition at line 858 of file Leap.py.

Leap.Gesture.STATE_STOP = LeapPython.Gesture_STATE_STOP
static

Definition at line 860 of file Leap.py.

Leap.Gesture.STATE_UPDATE = LeapPython.Gesture_STATE_UPDATE
static

Definition at line 859 of file Leap.py.

Leap.Gesture.this

Definition at line 867 of file Leap.py.

Leap.Gesture.type = _swig_property(LeapPython.Gesture_type_get)
static

Definition at line 879 of file Leap.py.

Leap.Gesture.TYPE_CIRCLE = LeapPython.Gesture_TYPE_CIRCLE
static

Definition at line 854 of file Leap.py.

Leap.Gesture.TYPE_INVALID = LeapPython.Gesture_TYPE_INVALID
static

Definition at line 852 of file Leap.py.

Leap.Gesture.TYPE_KEY_TAP = LeapPython.Gesture_TYPE_KEY_TAP
static

Definition at line 856 of file Leap.py.

Leap.Gesture.TYPE_SCREEN_TAP = LeapPython.Gesture_TYPE_SCREEN_TAP
static

Definition at line 855 of file Leap.py.

Leap.Gesture.TYPE_SWIPE = LeapPython.Gesture_TYPE_SWIPE
static

Definition at line 853 of file Leap.py.


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


leap_motion
Author(s): Florian Lier , Mirza Shah , Isaac IY Saito
autogenerated on Tue Jun 2 2020 03:58:01