Leap Motion C# API Reference  0.8.0
Leap.SwipeGesture Class Reference

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

Inherits Leap.Gesture.

Public Member Functions

 SwipeGesture (Gesture rhs)
 Constructs a SwipeGesture object from an instance of the Gesture class.
 
- Public Member Functions inherited from Leap.Gesture
bool Equals (Gesture rhs)
 Compare Gesture object equality.
 
 Gesture ()
 Constructs a new Gesture object.
 
 Gesture (Gesture rhs)
 Constructs a new copy of an Gesture object.
 
override string ToString ()
 A string containing a brief, human-readable description of this Gesture.
 

Static Public Member Functions

static Gesture.GestureType ClassType ()
 The swipe gesture type.
 

Properties

Vector Direction [get]
 The unit direction vector parallel to the swipe motion.
 
Pointable Pointable [get]
 The finger performing the swipe gesture.
 
Vector Position [get]
 The current position of the swipe.
 
float Speed [get]
 The swipe speed in mm/second.
 
Vector StartPosition [get]
 The position where the swipe began.
 
- Properties inherited from Leap.Gesture
long Duration [get]
 The elapsed duration of the recognized movement up to the frame containing this Gesture object, in microseconds.
 
float DurationSeconds [get]
 The elapsed duration in seconds.
 
Frame Frame [get]
 The Frame containing this Gesture instance.
 
HandList Hands [get]
 The list of hands associated with this Gesture, if any.
 
int Id [get]
 The gesture ID.
 
static Gesture Invalid [get]
 Returns an invalid Gesture object.
 
bool IsValid [get]
 Reports whether this Gesture instance represents a valid Gesture.
 
PointableList Pointables [get]
 The list of fingers and tools associated with this Gesture, if any.
 
Gesture.GestureState State [get]
 The gesture state.
 
Gesture.GestureType Type [get]
 The gesture type.
 

Additional Inherited Members

- Public Types inherited from Leap.Gesture
enum  GestureState { STATEINVALID = -1, STATESTART = 1, STATEUPDATE = 2, STATESTOP = 3 }
 The possible gesture states. More...
 
enum  GestureType {
  TYPEINVALID = -1, TYPESWIPE = 1, TYPECIRCLE = 4, TYPESCREENTAP = 5,
  TYPEKEYTAP = 6
}
 The supported types of gestures. More...
 

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:

Constructor & Destructor Documentation

Leap.SwipeGesture.SwipeGesture ( Gesture  rhs)
inline

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.

Member Function Documentation

static Gesture.GestureType Leap.SwipeGesture.ClassType ( )
inlinestatic

The swipe gesture type.

Returns
Type The type value designating a swipe gesture.

Property Documentation

Vector Leap.SwipeGesture.Direction
get

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.SwipeGesture.Pointable
get

The finger performing the swipe gesture.

Returns
Pointable A Pointable object representing the swiping finger.
Vector Leap.SwipeGesture.Position
get

The current position of the swipe.

Returns
Vector The current swipe position within the Leap Motion frame of reference, in mm.
float Leap.SwipeGesture.Speed
get

The swipe speed in mm/second.

Returns
float The speed of the finger performing the swipe gesture in millimeters per second.
Vector Leap.SwipeGesture.StartPosition
get

The position where the swipe began.

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