Leap Motion Java API Reference  0.8.0
com.leapmotion.leap.CircleGesture Class Reference

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

Inherits com.leapmotion.leap.Gesture.

Public Member Functions

Vector center ()
 The center point of the circle within the Leap Motion frame of reference.
 
 CircleGesture ()
 Constructs a new CircleGesture object.
 
 CircleGesture (Gesture rhs)
 Constructs a CircleGesture object from an instance of the Gesture class.
 
Vector normal ()
 Returns the normal vector for the circle being traced.
 
Pointable pointable ()
 The finger performing the circle gesture.
 
float progress ()
 The number of times the finger tip has traversed the circle.
 
float radius ()
 The radius of the circle.
 
- Public Member Functions inherited from com.leapmotion.leap.Gesture
long duration ()
 The elapsed duration of the recognized movement up to the frame containing this Gesture object, in microseconds.
 
float durationSeconds ()
 The elapsed duration in seconds.
 
boolean equals (Gesture rhs)
 Compare Gesture object equality.
 
Frame frame ()
 The Frame containing this Gesture instance.
 
 Gesture ()
 Constructs a new Gesture object.
 
 Gesture (Gesture rhs)
 Constructs a new copy of an Gesture object.
 
HandList hands ()
 The list of hands associated with this Gesture, if any.
 
int id ()
 The gesture ID.
 
boolean isValid ()
 Reports whether this Gesture instance represents a valid Gesture.
 
PointableList pointables ()
 The list of fingers and tools associated with this Gesture, if any.
 
Gesture.State state ()
 The gesture state.
 
String toString ()
 A string containing a brief, human-readable description of this Gesture.
 
Gesture.Type type ()
 The gesture type.
 

Static Public Member Functions

static Gesture.Type classType ()
 The circle gesture type.
 
- Static Public Member Functions inherited from com.leapmotion.leap.Gesture
static Gesture invalid ()
 Returns an invalid Gesture object.
 

Detailed Description

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 Motion device field of view.

Leap_Gesture_Circle.png

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

controller.enableGesture(Gesture.Type.TYPE_CIRCLE);

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:

if(controller.config().setFloat("Gesture.Circle.MinRadius", 10.0f) &&
controller.config().setFloat("Gesture.Circle.MinArc", .5f))
controller.config().save();

Constructor & Destructor Documentation

com.leapmotion.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.

com.leapmotion.leap.CircleGesture.CircleGesture ( Gesture  rhs)

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

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

Member Function Documentation

Vector com.leapmotion.leap.CircleGesture.center ( )

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

Returns
Vector The center of the circle in mm from the Leap Motion origin.
static Gesture.Type com.leapmotion.leap.CircleGesture.classType ( )
static

The circle gesture type.

Returns
Type The type value designating a circle gesture.
Vector com.leapmotion.leap.CircleGesture.normal ( )

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.

String clockwiseness;
if (circle.pointable().direction().angleTo(circle.normal()) <= Math.PI/2) {
clockwiseness = "clockwise";
}
else
{
clockwiseness = "counterclockwise";
}
Returns
Vector the normal vector for the circle being traced
Pointable com.leapmotion.leap.CircleGesture.pointable ( )

The finger performing the circle gesture.

Returns
Pointable A Pointable object representing the circling finger.
float com.leapmotion.leap.CircleGesture.progress ( )

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 the circle must be partially formed before the Leap Motion software can recognize it, progress will be greater than zero when a circle gesture first appears in the frame.

Returns
float A positive number indicating the gesture progress.
float com.leapmotion.leap.CircleGesture.radius ( )

The radius of the circle.

Returns
The circle radius in mm.