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

#include <Leap.h>

Inheritance diagram for Leap::ScreenTapGesture:

Detailed Description

The ScreenTapGesture class represents a tapping gesture by a finger or tool.

A screen tap gesture is recognized when the tip of a finger pokes forward and then springs back to approximately the original position, as if tapping a vertical screen. The tapping finger must pause briefly before beginning the tap.

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

ScreenTap gestures are discrete. The ScreenTapGesture object representing a tap always has the state, STATE_STOP. Only one ScreenTapGesture object is created for each screen tap gesture recognized.

You can set the minimum finger movement and velocity required for a movement to be recognized as a screen tap as well as adjust the detection window for evaluating the movement using the config attribute of a connected Controller object. Use the following keys to configure screen tap recognition:

Key string Value type Default value Units
Gesture.ScreenTap.MinForwardVelocity float 50 mm/s
Gesture.ScreenTap.HistorySeconds float 0.1 s
Gesture.ScreenTap.MinDistance float 3.0 mm

The following example demonstrates how to set the screen tap configuration parameters:

Public Member Functions

LEAP_EXPORT ScreenTapGesture ()
 
LEAP_EXPORT ScreenTapGesture (const Gesture &rhs)
 
LEAP_EXPORT Vector position () const
 
LEAP_EXPORT Vector direction () const
 
LEAP_EXPORT float progress () 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

◆ ScreenTapGesture() [1/2]

LEAP_EXPORT Leap::ScreenTapGesture::ScreenTapGesture ( )

Constructs a new ScreenTapGesture object.

An uninitialized ScreenTapGesture object is considered invalid. Get valid instances of the ScreenTapGesture class from a Frame object.

◆ ScreenTapGesture() [2/2]

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

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

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

Function details

◆ classType()

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

The screen tap gesture type.

Returns
Type The type value designating a screen tap gesture.

◆ direction()

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

The direction of finger tip motion.

Returns
Vector A unit direction vector.

◆ pointable()

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

The finger performing the screen tap gesture.

Returns
Pointable A Pointable object representing the tapping finger.

◆ position()

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

The position where the screen tap is registered.

Returns
Vector A Vector containing the coordinates of screen tap location.

◆ progress()

LEAP_EXPORT float Leap::ScreenTapGesture::progress ( ) const

The progress value is always 1.0 for a screen tap gesture.

Returns
float The value 1.0.