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

#include <Leap.h>

Inheritance diagram for Leap::SwipeGesture:

Detailed Description

The SwipeGesture class represents a swiping motion of a finger or tool.

Important: To use swipe gestures in your application, you must enable recognition of the swipe gesture. You can enable recognition with:

Swipe gestures are continuous.

You can set the minimum length and velocity required for a movement to be recognized as a swipe using the config attribute of a connected Controller object. Use the following keys to configure swipe recognition:

Key string Value type Default value Units
Gesture.Swipe.MinLength float 150 mm
Gesture.Swipe.MinVelocity float 1000 mm/s

The following example demonstrates how to set the swipe configuration parameters:

Public Member Functions

LEAP_EXPORT SwipeGesture ()
 
LEAP_EXPORT SwipeGesture (const Gesture &rhs)
 
LEAP_EXPORT Vector startPosition () const
 
LEAP_EXPORT Vector position () const
 
LEAP_EXPORT Vector direction () const
 
LEAP_EXPORT float speed () const
 
LEAP_EXPORT Pointable pointable () const
 
- Public Member Functions inherited from Leap::Gesture
 Gesture (GestureImplementation *)
 
LEAP_EXPORT Gesture ()
 
LEAP_EXPORT Gesture (const Gesture &rhs)
 
LEAP_EXPORT Type type () const
 
LEAP_EXPORT State state () const
 
LEAP_EXPORT int32_t id () const
 
LEAP_EXPORT int64_t duration () const
 
LEAP_EXPORT float durationSeconds () const
 
LEAP_EXPORT Frame frame () const
 
LEAP_EXPORT HandList hands () const
 
LEAP_EXPORT PointableList pointables () const
 
LEAP_EXPORT bool isValid () const
 
LEAP_EXPORT bool operator== (const Gesture &rhs) const
 
LEAP_EXPORT bool operator!= (const Gesture &rhs) const
 
LEAP_EXPORT std::string toString () const
 

Static Public Member Functions

static Type classType ()
 
- Static Public Member Functions inherited from Leap::Gesture
static LEAP_EXPORT const Gestureinvalid ()
 

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

◆ SwipeGesture() [1/2]

LEAP_EXPORT Leap::SwipeGesture::SwipeGesture ( )

◆ SwipeGesture() [2/2]

LEAP_EXPORT Leap::SwipeGesture::SwipeGesture ( const Gesture rhs)

Constructs a SwipeGesture object from an instance of the Gesture class.

Parameters
rhsThe Gesture instance to specialize. This Gesture instance must be a SwipeGesture object.

Function details

◆ classType()

static Type Leap::SwipeGesture::classType ( )
inlinestatic

The swipe gesture type.

Returns
Type The type value designating a swipe gesture.

◆ direction()

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

The unit direction vector parallel to the swipe motion.

You can compare the components of the vector to classify the swipe as appropriate for your application. For example, if you are using swipes for two dimensional scrolling, you can compare the x and y values to determine if the swipe is primarily horizontal or vertical.

Returns
Vector The unit direction vector representing the swipe motion.

◆ pointable()

LEAP_EXPORT Pointable Leap::SwipeGesture::pointable ( ) const

The finger performing the swipe gesture.

Returns
Pointable A Pointable object representing the swiping finger.

◆ position()

LEAP_EXPORT Vector Leap::SwipeGesture::position ( ) const

The current position of the swipe.

Returns
Vector The current swipe position within the Leap frame of reference, in mm.

◆ speed()

LEAP_EXPORT float Leap::SwipeGesture::speed ( ) const

The swipe speed in mm/second.

Returns
float The speed of the finger performing the swipe gesture in millimeters per second.

◆ startPosition()

LEAP_EXPORT Vector Leap::SwipeGesture::startPosition ( ) const

The position where the swipe began.

Returns
Vector The starting position within the Leap frame of reference, in mm.