de.voidplus.leapmotion
Class LeapMotion

java.lang.Object
  extended by de.voidplus.leapmotion.LeapMotion

public class LeapMotion
extends Object

Leap Motion Processing Library

Author:
Darius Morawiec

Field Summary
static String SDK_VERSION
           
static String VERSION
           
 
Constructor Summary
LeapMotion(PApplet parent)
          LeapMotion constructor to initialize the controller and listener.
LeapMotion(PApplet parent, boolean verbose)
          LeapMotion constructor to initialize the controller and listener.
 
Method Summary
 PVector convert(Vector position)
          Convert Vector to PVector without modifications
 int countFingers()
          Get the number of detected fingers.
 int countHands()
          Get the number of detected hands.
 int countTools()
          Get the number of detected tools.
 void dispose()
           
 Controller getController()
           
 ArrayList<Device> getDevices()
           
 Finger getFinger(Integer id)
          Get a specific finger.
 ArrayList<Finger> getFingers()
          Get all detected fingers.
 int getFrameRate()
          The instantaneous framerate.
 Finger getFrontFinger()
          The member of the list that is farthest to the front within the standard Leap Motion frame of reference (i.e has the smallest Z coordinate).
 Hand getFrontHand()
          The member of the list that is farthest to the front within the standard Leap Motion frame of reference (i.e has the smallest Z coordinate).
 Tool getFrontTool()
          The member of the list that is farthest to the front within the standard Leap Motion frame of reference (i.e has the smallest Z coordinate).
 Hand getHand(Integer id)
          Get a specific hand.
 ArrayList<Hand> getHands()
          Get all detected hands.
 Finger getLeftFinger()
          The member of the list that is farthest to the left within the standard Leap Motion frame of reference (i.e has the smallest X coordinate).
 Hand getLeftHand()
          The member of the list that is farthest to the left within the standard Leap Motion frame of reference (i.e has the smallest X coordinate).
 Tool getLeftTool()
          The member of the list that is farthest to the left within the standard Leap Motion frame of reference (i.e has the smallest X coordinate).
 Finger getRightFinger()
          The member of the list that is farthest to the right within the standard Leap Motion frame of reference (i.e has the largest X coordinate).
 Hand getRightHand()
          The member of the list that is farthest to the right within the standard Leap Motion frame of reference (i.e has the largest X coordinate).
 Tool getRightTool()
          The member of the list that is farthest to the right within the standard Leap Motion frame of reference (i.e has the largest X coordinate).
 Tool getTool(Integer id)
          Get a specific tool.
 ArrayList<Tool> getTools()
          Get all detected tools.
 String getVersion()
          Get the version of the library.
 String getVersionSDK()
          Get the used version of the SDK.
 boolean hasFingers()
          Check if there is any finger.
 boolean hasHands()
          Check if there is any hand.
 boolean hasTools()
          Check if there is any tool.
 boolean isConnected()
          Check if the Leap Motion is connected.
 PVector map(Vector position)
          Convert/map the Vector data to sketch PVector data with world settings.
 void pre()
          Run the recognizer before the drawing.
 LeapMotion setConfig(String keyString, boolean value)
          Set configuration parameters.
 LeapMotion setConfig(String keyString, float value)
          Set configuration parameters.
 LeapMotion setConfig(String keyString, int value)
          Set configuration parameters.
 LeapMotion setConfig(String keyString, String value)
          Set configuration parameters.
 LeapMotion setGestureCircleMinArc(float degrees)
          Set Gesture.Circle.MinArc (Default: 270 degrees)
 LeapMotion setGestureCircleMinRadius(float mm)
          Set Gesture.Circle.MinRadius (Default: 5.0 mm)
 LeapMotion setGestureKeyTapHistorySeconds(float s)
          Set Gesture.KeyTap.HistorySeconds (Default: 0.1 s)
 LeapMotion setGestureKeyTapMinDistance(float mm)
          Set Gesture.KeyTap.MinDistance (Default: 3.0 mm)
 LeapMotion setGestureKeyTapMinDownVelocity(float mms)
          Set Gesture.KeyTap.MinDownVelocity (Default: 50 mm/s)
 LeapMotion setGestureScreenTapHistorySeconds(float s)
          Set Gesture.ScreenTap.HistorySeconds (Default: 0.1 s)
 LeapMotion setGestureScreenTapMinDistance(float mm)
          Set Gesture.ScreenTap.MinDistance (Default: 5.0 mm)
 LeapMotion setGestureScreenTapMinForwardVelocity(float mms)
          Set Gesture.ScreenTap.MinForwardVelocity (Default: 50 mm/s)
 LeapMotion setGestureSwipeMinLength(float mm)
          Set Gesture.Swipe.MinLength (Default: 150 mm)
 LeapMotion setGestureSwipeMinVelocity(float mms)
          Set Gesture.Swipe.MinVelocity (Default: 1000 mm/s)
 LeapMotion setVerbose(boolean verbose)
          Print debug information to the console.
 LeapMotion setWorld(int width, int height, int depth)
          Set the world coordinates.
 LeapMotion setWorld(PVector world)
          Set the world coordinates.
 LeapMotion withGestures()
           
 LeapMotion withGestures(String str)
          Activate the gesture recognition.
 LeapMotion withoutGestures()
          Deactivate the gesture recognition.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
See Also:
Constant Field Values

SDK_VERSION

public static final String SDK_VERSION
See Also:
Constant Field Values
Constructor Detail

LeapMotion

public LeapMotion(PApplet parent,
                  boolean verbose)
LeapMotion constructor to initialize the controller and listener.

Parameters:
parent - Reference (this) of sketch.
verbose - Print debug information to the console.

LeapMotion

public LeapMotion(PApplet parent)
LeapMotion constructor to initialize the controller and listener.

Parameters:
parent - Reference (this) of sketch.
Method Detail

getFrameRate

public int getFrameRate()
The instantaneous framerate.

Returns:

setWorld

public LeapMotion setWorld(int width,
                           int height,
                           int depth)
Set the world coordinates.

Parameters:
width - World width dimension in millimeters.
height - World height dimension in millimeters.
depth - World depth dimension in millimeters.
Returns:

setWorld

public LeapMotion setWorld(PVector world)
Set the world coordinates.

Parameters:
world - World dimensions in millimeters.
Returns:

isConnected

public boolean isConnected()
Check if the Leap Motion is connected.

Returns:

getController

public Controller getController()

getDevices

public ArrayList<Device> getDevices()

hasHands

public boolean hasHands()
Check if there is any hand.

Returns:

getHand

public Hand getHand(Integer id)
Get a specific hand.

Parameters:
id -
Returns:

getHands

public ArrayList<Hand> getHands()
Get all detected hands.

Returns:

countHands

public int countHands()
Get the number of detected hands.

Returns:

getFrontHand

public Hand getFrontHand()
The member of the list that is farthest to the front within the standard Leap Motion frame of reference (i.e has the smallest Z coordinate).

Returns:

getLeftHand

public Hand getLeftHand()
The member of the list that is farthest to the left within the standard Leap Motion frame of reference (i.e has the smallest X coordinate).

Returns:

getRightHand

public Hand getRightHand()
The member of the list that is farthest to the right within the standard Leap Motion frame of reference (i.e has the largest X coordinate).

Returns:

hasFingers

public boolean hasFingers()
Check if there is any finger.

Returns:

getFinger

public Finger getFinger(Integer id)
Get a specific finger.

Parameters:
id -
Returns:

getFingers

public ArrayList<Finger> getFingers()
Get all detected fingers.

Returns:

countFingers

public int countFingers()
Get the number of detected fingers.

Returns:

getFrontFinger

public Finger getFrontFinger()
The member of the list that is farthest to the front within the standard Leap Motion frame of reference (i.e has the smallest Z coordinate).

Returns:

getLeftFinger

public Finger getLeftFinger()
The member of the list that is farthest to the left within the standard Leap Motion frame of reference (i.e has the smallest X coordinate).

Returns:

getRightFinger

public Finger getRightFinger()
The member of the list that is farthest to the right within the standard Leap Motion frame of reference (i.e has the largest X coordinate).

Returns:

hasTools

public boolean hasTools()
Check if there is any tool.

Returns:

getTool

public Tool getTool(Integer id)
Get a specific tool.

Parameters:
id -
Returns:

getTools

public ArrayList<Tool> getTools()
Get all detected tools.

Returns:

countTools

public int countTools()
Get the number of detected tools.

Returns:

getFrontTool

public Tool getFrontTool()
The member of the list that is farthest to the front within the standard Leap Motion frame of reference (i.e has the smallest Z coordinate).

Returns:

getLeftTool

public Tool getLeftTool()
The member of the list that is farthest to the left within the standard Leap Motion frame of reference (i.e has the smallest X coordinate).

Returns:

getRightTool

public Tool getRightTool()
The member of the list that is farthest to the right within the standard Leap Motion frame of reference (i.e has the largest X coordinate).

Returns:

withGestures

public LeapMotion withGestures(String str)
Activate the gesture recognition.

Parameters:
str -
Returns:

withGestures

public LeapMotion withGestures()

withoutGestures

public LeapMotion withoutGestures()
Deactivate the gesture recognition.

Returns:

pre

public void pre()
Run the recognizer before the drawing.


setGestureCircleMinRadius

public LeapMotion setGestureCircleMinRadius(float mm)
Set Gesture.Circle.MinRadius (Default: 5.0 mm)

Parameters:
mm -
Returns:

setGestureCircleMinArc

public LeapMotion setGestureCircleMinArc(float degrees)
Set Gesture.Circle.MinArc (Default: 270 degrees)

Parameters:
degrees -
Returns:

setGestureSwipeMinLength

public LeapMotion setGestureSwipeMinLength(float mm)
Set Gesture.Swipe.MinLength (Default: 150 mm)

Parameters:
mm -
Returns:

setGestureSwipeMinVelocity

public LeapMotion setGestureSwipeMinVelocity(float mms)
Set Gesture.Swipe.MinVelocity (Default: 1000 mm/s)

Parameters:
mms -
Returns:

setGestureKeyTapMinDownVelocity

public LeapMotion setGestureKeyTapMinDownVelocity(float mms)
Set Gesture.KeyTap.MinDownVelocity (Default: 50 mm/s)

Parameters:
mms -
Returns:

setGestureKeyTapHistorySeconds

public LeapMotion setGestureKeyTapHistorySeconds(float s)
Set Gesture.KeyTap.HistorySeconds (Default: 0.1 s)

Parameters:
s -
Returns:

setGestureKeyTapMinDistance

public LeapMotion setGestureKeyTapMinDistance(float mm)
Set Gesture.KeyTap.MinDistance (Default: 3.0 mm)

Parameters:
mm -
Returns:

setGestureScreenTapMinForwardVelocity

public LeapMotion setGestureScreenTapMinForwardVelocity(float mms)
Set Gesture.ScreenTap.MinForwardVelocity (Default: 50 mm/s)

Parameters:
mms -
Returns:

setGestureScreenTapHistorySeconds

public LeapMotion setGestureScreenTapHistorySeconds(float s)
Set Gesture.ScreenTap.HistorySeconds (Default: 0.1 s)

Parameters:
s -
Returns:

setGestureScreenTapMinDistance

public LeapMotion setGestureScreenTapMinDistance(float mm)
Set Gesture.ScreenTap.MinDistance (Default: 5.0 mm)

Parameters:
mm -
Returns:

setConfig

public LeapMotion setConfig(String keyString,
                            int value)
Set configuration parameters.

Parameters:
keyString -
value -
Returns:

setConfig

public LeapMotion setConfig(String keyString,
                            float value)
Set configuration parameters.

Parameters:
keyString -
value -
Returns:

setConfig

public LeapMotion setConfig(String keyString,
                            boolean value)
Set configuration parameters.

Parameters:
keyString -
value -
Returns:

setConfig

public LeapMotion setConfig(String keyString,
                            String value)
Set configuration parameters.

Parameters:
keyString -
value -
Returns:

map

public PVector map(Vector position)
Convert/map the Vector data to sketch PVector data with world settings.

Parameters:
position -
Returns:

convert

public PVector convert(Vector position)
Convert Vector to PVector without modifications

Parameters:
position -
Returns:

setVerbose

public LeapMotion setVerbose(boolean verbose)
Print debug information to the console.

Parameters:
verbose -
Returns:

getVersion

public String getVersion()
Get the version of the library.

Returns:

getVersionSDK

public String getVersionSDK()
Get the used version of the SDK.

Returns:

dispose

public void dispose()


Processing library LeapMotionForProcessing by Darius Morawiec. (C) 2013