#include <Leap.h>
The CircleGesture classes represents a circular finger movement.
A circle movement is recognized when the tip of a finger draws a circle within the Leap field of view.
Important: To use circle gestures in your application, you must enable recognition of the circle gesture. You can enable recognition with:
Circle gestures are continuous. The CircleGesture objects for the gesture have three possible states:
You can set the minimum radius and minimum arc length required for a movement to be recognized as a circle using the config attribute of a connected Controller object. Use the following keys to configure circle recognition:
Key string | Value type | Default value | Units |
---|---|---|---|
Gesture.Circle.MinRadius | float | 5.0 | mm |
Gesture.Circle.MinArc | float | 1.5*pi | radians |
The following example demonstrates how to set the circle configuration parameters:
Public Member Functions | |
LEAP_EXPORT | CircleGesture () |
LEAP_EXPORT | CircleGesture (const Gesture &rhs) |
LEAP_EXPORT Vector | center () const |
LEAP_EXPORT Vector | normal () const |
LEAP_EXPORT float | progress () const |
LEAP_EXPORT float | radius () const |
LEAP_EXPORT Pointable | pointable () const |
![]() | |
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 LEAP_EXPORT const Gesture & | invalid () |
Additional Inherited Members | |
![]() | |
class SharedObject * | m_object |
![]() | |
LEAP_EXPORT | Interface (void *owner) |
LEAP_EXPORT | Interface (Implementation *reference, void *owner) |
LEAP_EXPORT | Interface (const Interface &rhs) |
LEAP_EXPORT Interface & | operator= (const Interface &rhs) |
virtual LEAP_EXPORT | ~Interface () |
template<typename T > | |
T * | get () const |
LEAP_EXPORT Leap::CircleGesture::CircleGesture | ( | ) |
Constructs a new CircleGesture object.
An uninitialized CircleGesture object is considered invalid. Get valid instances of the CircleGesture class from a Frame object.
LEAP_EXPORT Leap::CircleGesture::CircleGesture | ( | const Gesture & | rhs | ) |
Constructs a CircleGesture object from an instance of the Gesture class.
rhs | The Gesture instance to specialize. This Gesture instance must be a CircleGesture object. |
LEAP_EXPORT Vector Leap::CircleGesture::center | ( | ) | const |
|
inlinestatic |
The circle gesture type.
LEAP_EXPORT Vector Leap::CircleGesture::normal | ( | ) | const |
Returns the normal vector for the circle being traced.
If you draw the circle clockwise, the normal vector points in the same general direction as the pointable object drawing the circle. If you draw the circle counterclockwise, the normal points back toward the pointable. If the angle between the normal and the pointable object drawing the circle is less than 90 degrees, then the circle is clockwise.
std::string clockwiseness; if (circle.pointable().direction().angleTo(circle.normal()) <= PI/4) { clockwiseness = "clockwise"; } else { clockwiseness = "counterclockwise"; }
LEAP_EXPORT Pointable Leap::CircleGesture::pointable | ( | ) | const |
LEAP_EXPORT float Leap::CircleGesture::progress | ( | ) | const |
The number of times the finger tip has traversed the circle.
Progress is reported as a positive number of the number. For example, a progress value of .5 indicates that the finger has gone halfway around, while a value of 3 indicates that the finger has gone around the the circle three times.
Progress starts where the circle gesture began. Since it the circle must be partially formed before the Leap can recognize it, progress will be greater than zero when a circle gesture first appears in the frame.
LEAP_EXPORT float Leap::CircleGesture::radius | ( | ) | const |
The radius of the circle.