CircleGestureΒΆ

The CircleGesture classes represents a circular finger movement. More...

Inherits Gesture.

Public Types

enum  State
 The possible gesture states. More...
 
enum  Type
 The supported types of gestures. More...
 

Public Member Functions

Vector center () const
 The center point of the circle within the Leap Motion frame of reference. More...
 
 CircleGesture ()
 Constructs a new CircleGesture object. More...
 
 CircleGesture (const Gesture &rhs)
 Constructs a CircleGesture object from an instance of the Gesture class. More...
 
int64_t duration () const
 The elapsed duration of the recognized movement up to the frame containing this Gesture object, in microseconds. More...
 
float durationSeconds () const
 The elapsed duration in seconds. More...
 
Frame frame () const
 The Frame containing this Gesture instance. More...
 
HandList hands () const
 The list of hands associated with this Gesture, if any. More...
 
int32_t id () const
 The gesture ID. More...
 
bool isValid () const
 Reports whether this Gesture instance represents a valid Gesture. More...
 
Vector normal () const
 Returns the normal vector for the circle being traced. More...
 
bool operator!= (const Gesture &rhs) const
 Compare Gesture object inequality. More...
 
bool operator== (const Gesture &rhs) const
 Compare Gesture object equality. More...
 
Pointable pointable () const
 The finger performing the circle gesture. More...
 
PointableList pointables () const
 The list of fingers and tools associated with this Gesture, if any. More...
 
float progress () const
 The number of times the finger tip has traversed the circle. More...
 
float radius () const
 The radius of the circle. More...
 
State state () const
 The gesture state. More...
 
std::string toString () const
 A string containing a brief, human-readable description of this Gesture. More...
 
Type type () const
 The gesture type. More...
 

Static Public Member Functions

static Type classType ()
 The circle gesture type. More...
 
static const Gestureinvalid ()
 Returns an invalid Gesture object. More...
 

Detailed Description

The CircleGesture classes represents a circular finger movement.

Deprecated:
3.0

Member Enumeration Documentation

enum State
inherited

The possible gesture states.

Deprecated:
3.0
Enumerator
STATE_INVALID 

An invalid state.

Deprecated:
3.0
STATE_START 

The gesture is starting.

Just enough has happened to recognize it.

Deprecated:
3.0
STATE_UPDATE 

The gesture is in progress.

(Note: not all gestures have updates).

Deprecated:
3.0
STATE_STOP 

The gesture has completed or stopped.

Deprecated:
3.0
enum Type
inherited

The supported types of gestures.

Deprecated:
3.0
Enumerator
TYPE_INVALID 

An invalid type.

Deprecated:
3.0
TYPE_SWIPE 

A straight line movement by the hand with fingers extended.

Deprecated:
3.0
TYPE_CIRCLE 

A circular movement by a finger.

Deprecated:
3.0
TYPE_SCREEN_TAP 

A forward tapping movement by a finger.

Deprecated:
3.0
TYPE_KEY_TAP 

A downward tapping movement by a finger.

Deprecated:
3.0

Constructor & Destructor Documentation

Constructs a new CircleGesture object.

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

Deprecated:
3.0
CircleGesture ( const Gesture rhs)

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

if(gesture.type() == Leap::Gesture::TYPE_CIRCLE){
Leap::CircleGesture circleGesture = Leap::CircleGesture(gesture);
}
Parameters
rhsThe Gesture instance to specialize. This Gesture instance must be a CircleGesture object.
Deprecated:
3.0

Member Function Documentation

Vector center ( ) const

The center point of the circle within the Leap Motion frame of reference.

Leap::Vector centerPoint = circle.center();
Returns
Vector The center of the circle in mm from the Leap Motion origin.
Deprecated:
3.0
static Type classType ( )
inlinestatic

The circle gesture type.

if(gesture.type() == Leap::CircleGesture::classType()){
Leap::CircleGesture circleGesture = Leap::CircleGesture(gesture);
}
Returns
Type The type value designating a circle gesture.
Deprecated:
3.0
int64_t duration ( ) const
inherited

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

float microseconds = gesture.duration();

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.
Deprecated:
3.0
float durationSeconds ( ) const
inherited

The elapsed duration in seconds.

float seconds = gesture.durationSeconds();
See also
duration()
Returns
float the elapsed duration in seconds.
Deprecated:
3.0
Frame frame ( ) const
inherited

The Frame containing this Gesture instance.

Leap::Frame frameOfGesture = gesture.frame();
Returns
Frame The parent Frame object.
Deprecated:
3.0
HandList hands ( ) const
inherited

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

Leap::HandList handsForGesture = gesture.hands();

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

Returns
HandList the list of related Hand objects.
Deprecated:
3.0
int32_t id ( ) const
inherited

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.

int32_t gestureOfInterest = gesture.id();
Leap::GestureList manyGestures = frame.gestures(olderFrame);
for(Leap::GestureList::const_iterator gl = manyGestures.begin(); gl != manyGestures.end(); gl++)
{
if ((*gl).id() == gestureOfInterest) {
//Process it...
}
}
Returns
int32_t the ID of this Gesture.
Deprecated:
3.0
static const Gesture& invalid ( )
staticinherited

Returns an invalid Gesture object.

Leap::Gesture trackedGesture = frame.gesture(gestureID);
if (trackedGesture != Leap::Gesture::invalid()) {
//Process it...
}
Returns
The invalid Gesture instance.
Deprecated:
3.0
bool isValid ( ) const
inherited

Reports whether this Gesture instance represents a valid Gesture.

if (gesture.isValid()) {
// Process it...
}
Returns
bool True, if this is a valid Gesture instance; false, otherwise.
Deprecated:
3.0
Vector normal ( ) const

Returns the normal vector for the circle being traced.

std::string clockwiseness;
if (circle.pointable().direction().angleTo(circle.normal()) <= Leap::PI/2) {
clockwiseness = "clockwise";
}
else
{
clockwiseness = "counterclockwise";
}
Returns
Vector the normal vector for the circle being traced
Deprecated:
3.0
bool operator!= ( const Gesture rhs) const
inherited

Compare Gesture object inequality.

thisGesture != thatGesture;

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

Deprecated:
3.0
bool operator== ( const Gesture rhs) const
inherited

Compare Gesture object equality.

thisGesture == thatGesture;

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

Deprecated:
3.0
Pointable pointable ( ) const

The finger performing the circle gesture.

Leap::Pointable circlePointable = circle.pointable();
Returns
Pointable A Pointable object representing the circling finger.
Deprecated:
3.0
PointableList pointables ( ) const
inherited

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.

Leap::PointableList pointablesForGesture = gesture.pointables();
Returns
PointableList the list of related Pointable objects.
Deprecated:
3.0
float progress ( ) const

The number of times the finger tip has traversed the circle.

float turns = circle.progress();
Returns
float A positive number indicating the gesture progress.
Deprecated:
3.0
float radius ( ) const

The radius of the circle.

float diameter = 2 * circle.radius();
Returns
The circle radius in mm.
Deprecated:
3.0
State state ( ) const
inherited

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.

for(Leap::GestureList::const_iterator gl = gestures.begin(); gl != gestures.end(); gl++)
{
switch ((*gl).state()) {
//Handle starting gestures
break;
//Handle continuing gestures
break;
//Handle ending gestures
break;
default:
//Handle unrecognized states
break;
}
}
Returns
Gesture::State A value from the Gesture::State enumeration.
Deprecated:
3.0
std::string toString ( ) const
inlineinherited

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

for(Leap::GestureList::const_iterator gl = gestures.begin(); gl != gestures.end(); gl++)
std::cout << (*gl).toString() << std::endl;
Deprecated:
3.0
Type type ( ) const
inherited

The gesture type.

for(Leap::GestureList::const_iterator gl = gestures.begin(); gl != frame.gestures().end(); gl++)
{
switch ((*gl).type()) {
//Handle circle gestures
break;
//Handle key tap gestures
break;
//Handle screen tap gestures
break;
//Handle swipe gestures
break;
default:
//Handle unrecognized gestures
break;
}
}
Returns
Gesture::Type A value from the Gesture::Type enumeration.
Deprecated:
3.0