A Top
- AngleTo — public method in class Leap.Vector
-
The angle between this vector and the specified vector in radians.
The angle is measured in the plane formed by the two vectors. The angle returned is always the smaller of the two conjugate angles. Thus A.angleTo(B) == B.angleTo(A) and is always a positive value less than or equal to pi radians (180 degrees).
If either vector has zero length, then this function returns zero.
C Top
- CircleGesture — class in namespace Leap
-
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.
Circle gestures are continuous. The CircleGesture objects for the gesture have three possible states:
- start -- The circle gesture has just started. The movement has progressed far enough for the recognizer to classify it as a circle.
- update -- The circle gesture is continuing.
- stop -- The circle gesture is finished.
- compare — public method in class Leap.Matrix
-
Compare Matrix equality component-wise.
- compare — public method in class Leap.Vector
-
Compare Vector equality component-wise.
- Controller — class in namespace Leap
-
The Controller class is your main interface to the Leap Motion Controller.
Create an instance of this Controller class to access frames of tracking data and configuration information. Frame data can be polled at any time using the Controller.frame() function. Call frame() or frame(0) to get the most recent frame. Set the history parameter to a positive integer to access previous frames. A controller stores up to 60 frames in its frame history.
Polling is an appropriate strategy for applications which already have an intrinsic update loop, such as a game.
- Cross — public method in class Leap.Vector
-
The cross product of this vector and the specified vector.
The cross product is a vector orthogonal to both original vectors. It has a magnitude equal to the area of a parallelogram having the two vectors as sides. The direction of the returned vector is determined by the right-hand rule. Thus A.cross(B) == -B.cross(A).
D Top
- distanceTo — public method in class Leap.Vector
-
The distance between the point represented by this Vector object and a point represented by the specified Vector object.
- dividedBy — public method in class Leap.Vector
-
Divide vector by a scalar.
- dot — public method in class Leap.Vector
-
The dot product of this vector with another vector.
The dot product is the magnitude of the projection of this vector onto the specified vector.
- dump — public method in class Leap.Frame
-
Returns a JSON-formatted string containing the hands, pointables and gestures in this frame.
F Top
- finger — public method in class Leap.Frame
-
The finger with the specified ID in this frame.
Use the Frame finger() function to retrieve the finger from this frame using an ID value obtained from a previous frame. This function always returns a Finger object, but if no finger with the specified ID is present, an invalid Pointable object is returned.
Note that ID values persist across frames, but only until tracking of a particular object is lost. If tracking of a finger is lost and subsequently regained, the new Pointable object representing that physical finger may have a different ID than that representing the finger in an earlier frame.
- finger — public method in class Leap.Hand
-
The finger with the specified ID attached to this hand.
Use this function to retrieve a Pointable object representing a finger attached to this hand using an ID value obtained from a previous frame. This function always returns a Pointable object, but if no finger with the specified ID is present, an invalid Pointable object is returned.
Note that the ID values assigned to fingers persist across frames, but only until tracking of a particular finger is lost. If tracking of a finger is lost and subsequently regained, the new Finger object representing that finger may have a different ID than that representing the finger in an earlier frame.
- Frame — class in namespace Leap
-
The Frame class represents a set of hand and finger tracking data detected in a single frame.
The Leap detects hands, fingers and tools within the tracking area, reporting their positions, orientations and motions in frames at the Leap frame rate.
Access Frame objects using the Controller.frame() function.
- frame — public method in class Leap.Controller
-
Returns a frame of tracking data from the Leap.
Use the optional history parameter to specify which frame to retrieve. Call frame() or frame(0) to access the most recent frame; call frame(1) to access the previous frame, and so on. If you use a history value greater than the number of stored frames, then the controller returns an invalid frame.
G Top
- Gesture — abstract class in namespace Leap
-
The Gesture class represents a recognized movement by the user.
The Leap watches the activity within its field of view for certain movement patterns typical of a user gesture or command. For example, a movement from side to side with the hand can indicate a swipe gesture, while a finger poking forward can indicate a screen tap gesture.
When the Leap recognizes a gesture, it assigns an ID and adds a Gesture object to the frame gesture list. For continuous gestures, which occur over many frames, the Leap updates the gesture by adding a Gesture object having the same ID and updated properties in each subsequent frame.
Important: Recognition for each type of gesture must be enabled; otherwise no gestures are recognized or reported.
Subclasses of Gesture define the properties for the specific movement patterns recognized by the Leap.
The Gesture subclasses for include:
- CircleGesture -- A circular movement by a finger.
- SwipeGesture -- A straight line movement by the hand with fingers extended.
- ScreenTapGesture -- A forward tapping movement by a finger.
- KeyTapGesture -- A downward tapping movement by a finger.
Circle and swipe gestures are continuous and these objects can have a state of start, update, and stop.
The screen tap gesture is a discrete gesture. The Leap only creates a single ScreenTapGesture object appears for each tap and it always has a stop state.
Get valid Gesture instances from a Frame object. You can get a list of gestures from the Frame gestures array. You can also use the Frame gesture() method to find a gesture in the current frame using an ID value obtained in a previous frame.
Gesture objects can be invalid. For example, when you get a gesture by ID using Frame.gesture(), and there is no gesture with that ID in the current frame, then gesture() returns an Invalid Gesture object (rather than a null value). Always check object validity in situations where a gesture might be invalid.
H Top
- Hand — class in namespace Leap
-
The Hand class reports the physical characteristics of a detected hand.
Hand tracking data includes a palm position and velocity; vectors for the palm normal and direction to the fingers; properties of a sphere fit to the hand; and lists of the attached fingers and tools.
Note that Hand objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical entity. Invalid Hand objects can be the result of asking for a Hand object using an ID from an earlier frame when no Hand objects with that ID exist in the current frame. A Hand object created from the Hand constructor is also invalid. Test for validity with the Hand.valid property.
- hand — public method in class Leap.Frame
-
The Hand object with the specified ID in this frame.
Use the Frame hand() function to retrieve the Hand object from this frame using an ID value obtained from a previous frame. This function always returns a Hand object, but if no hand with the specified ID is present, an invalid Hand object is returned.
Note that ID values persist across frames, but only until tracking of a particular object is lost. If tracking of a hand is lost and subsequently regained, the new Hand object representing that physical hand may have a different ID than that representing the physical hand in an earlier frame.
I Top
- isValid — public method in class Leap.Vector
-
Returns true if all of the vector's components are finite.
If any component is NaN or infinite, then this returns false.
K Top
- KeyTapGesture — class in namespace Leap
-
The KeyTapGesture class represents a tapping gesture by a finger or tool.
A key tap gesture is recognized when the tip of a finger rotates down toward the palm and then springs back to approximately the original postion, as if tapping. The tapping finger must pause briefly before beginning the tap.
Key tap gestures are discrete. The KeyTapGesture object representing a tap always has the state, STATE_STOP. Only one KeyTapGesture object is created for each key tap gesture recognized.
L Top
- Leap — namespace
-
Leap is the global namespace of the Leap API.
- loop — static public method in class Leap
-
The Leap.loop() function passes a frame of Leap data to your callback function and then calls window.requestAnimationFrame() after executing your callback function.
Leap.loop() sets up the Leap controller and WebSocket connection for you. You do not need to create your own controller when using this method.
Your callback function is called on an interval determined by the client browser. Typically, this is on an interval of 60 frames/second. The most recent frame of Leap data is passed to your callback function. If the Leap is producing frames at a slower rate than the browser frame rate, the same frame of Leap data can be passed to your function in successive animation updates.
As an alternative, you can create your own Controller object and use a Controller#onFrame onFrame callback to process the data at the frame rate of the Leap device. See Controller for an example.
M Top
- magnitude — public method in class Leap.Vector
-
The magnitude, or length, of this vector.
The magnitude is the L2 norm, or Euclidean distance between the origin and the point represented by the (x, y, z) components of this Vector object.
- magnitudeSquared — public method in class Leap.Vector
-
The square of the magnitude, or length, of this vector.
- Matrix — class in namespace Leap
-
The Matrix object represents a transformation matrix.
To use this object to transform a Vector, construct a matrix containing the desired transformation and then use the Matrix.transformPoint() or Matrix.transformDirection() functions to apply the transform.
Transforms can be combined by multiplying two or more transform matrices using the times function.
- minus — public method in class Leap.Vector
-
Subtract vectors component-wise.
- multiply — public method in class Leap.Vector
-
Multiply vector by a scalar.
N Top
- normalized — public method in class Leap.Vector
-
A normalized copy of this vector.
A normalized vector has the same direction as the original vector, but with a length of one.
P Top
- pitch — public method in class Leap.Vector
-
The pitch angle in radians.
Pitch is the angle between the negative z-axis and the projection of the vector onto the y-z plane. In other words, pitch represents rotation around the x-axis. If the vector points upward, the returned angle is between 0 and pi radians (180 degrees); if it points downward, the angle is between 0 and -pi radians.
- plus — public method in class Leap.Vector
-
Add vectors component-wise.
- Pointable — class in namespace Leap
-
The Pointable class reports the physical characteristics of a detected finger or tool.
Both fingers and tools are classified as Pointable objects. Use the Pointable.tool property to determine whether a Pointable object represents a tool or finger. The Leap classifies a detected entity as a tool when it is thinner, straighter, and longer than a typical finger.
Note that Pointable objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical entity. Invalid Pointable objects can be the result of asking for a Pointable object using an ID from an earlier frame when no Pointable objects with that ID exist in the current frame. A Pointable object created from the Pointable constructor is also invalid. Test for validity with the Pointable.valid property.
- pointable — public method in class Leap.Frame
-
The Pointable object with the specified ID in this frame.
Use the Frame pointable() function to retrieve the Pointable object from this frame using an ID value obtained from a previous frame. This function always returns a Pointable object, but if no finger or tool with the specified ID is present, an invalid Pointable object is returned.
Note that ID values persist across frames, but only until tracking of a particular object is lost. If tracking of a finger or tool is lost and subsequently regained, the new Pointable object representing that finger or tool may have a different ID than that representing the finger or tool in an earlier frame.
R Top
- rigidInverse — public method in class Leap.Matrix
-
Performs a matrix inverse if the matrix consists entirely of rigid transformations (translations and rotations).
If the matrix is not rigid, this operation will not represent an inverse.
Note that all matricies that are directly returned by the API are rigid.
- roll — public method in class Leap.Vector
-
The roll angle in radians.
Roll is the angle between the y-axis and the projection of the vector onto the x-y plane. In other words, roll represents rotation around the z-axis. If the vector points to the left of the y-axis, then the returned angle is between 0 and pi radians (180 degrees); if it points to the right, the angle is between 0 and -pi radians.
Use this function to get roll angle of the plane to which this vector is a normal. For example, if this vector represents the normal to the palm, then this function returns the tilt or roll of the palm plane compared to the horizontal (x-z) plane.
- rotationAngle — public method in class Leap.Frame
-
The angle of rotation around the rotation axis derived from the overall rotational motion between the current frame and the specified frame.
The returned angle is expressed in radians measured clockwise around the rotation axis (using the right-hand rule) between the start and end frames. The value is always between 0 and pi radians (0 and 180 degrees).
The Leap derives frame rotation from the relative change in position and orientation of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, then the angle of rotation is zero.
- rotationAngle — public method in class Leap.Hand
-
The angle of rotation around the rotation axis derived from the change in orientation of this hand, and any associated fingers and tools, between the current frame and the specified frame.
The returned angle is expressed in radians measured clockwise around the rotation axis (using the right-hand rule) between the start and end frames. The value is always between 0 and pi radians (0 and 180 degrees).
If a corresponding Hand object is not found in sinceFrame, or if either this frame or sinceFrame are invalid Frame objects, then the angle of rotation is zero.
- rotationAxis — public method in class Leap.Frame
-
The axis of rotation derived from the overall rotational motion between the current frame and the specified frame.
The returned direction vector is normalized.
The Leap derives frame rotation from the relative change in position and orientation of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, or if no rotation is detected between the two frames, a zero vector is returned.
- rotationAxis — public method in class Leap.Hand
-
The axis of rotation derived from the change in orientation of this hand, and any associated fingers and tools, between the current frame and the specified frame.
The returned direction vector is normalized.
If a corresponding Hand object is not found in sinceFrame, or if either this frame or sinceFrame are invalid Frame objects, then this method returns a zero vector.
- rotationMatrix — public method in class Leap.Frame
-
The transform matrix expressing the rotation derived from the overall rotational motion between the current frame and the specified frame.
The Leap derives frame rotation from the relative change in position and orientation of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, then this method returns an identity matrix.
- rotationMatrix — public method in class Leap.Hand
-
The transform matrix expressing the rotation derived from the change in orientation of this hand, and any associated fingers and tools, between the current frame and the specified frame.
If a corresponding Hand object is not found in sinceFrame, or if either this frame or sinceFrame are invalid Frame objects, then this method returns an identity matrix.
S Top
- scaleFactor — public method in class Leap.Frame
-
The scale factor derived from the overall motion between the current frame and the specified frame.
The scale factor is always positive. A value of 1.0 indicates no scaling took place. Values between 0.0 and 1.0 indicate contraction and values greater than 1.0 indicate expansion.
The Leap derives scaling from the relative inward or outward motion of all objects detected in the field of view (independent of translation and rotation).
If either this frame or sinceFrame is an invalid Frame object, then this method returns 1.0.
- scaleFactor — public method in class Leap.Hand
-
The scale factor derived from the hand's motion between the current frame and the specified frame.
The scale factor is always positive. A value of 1.0 indicates no scaling took place. Values between 0.0 and 1.0 indicate contraction and values greater than 1.0 indicate expansion.
The Leap derives scaling from the relative inward or outward motion of a hand and its associated fingers and tools (independent of translation and rotation).
If a corresponding Hand object is not found in sinceFrame, or if either this frame or sinceFrame are invalid Frame objects, then this method returns 1.0.
- ScreenTapGesture — class in namespace Leap
-
The ScreenTapGesture class represents a tapping gesture by a finger or tool.
A screen tap gesture is recognized when the tip of a finger pokes forward and then springs back to approximately the original postion, as if tapping a vertical screen. The tapping finger must pause briefly before beginning the tap.
ScreenTap gestures are discrete. The ScreenTapGesture object representing a tap always has the state, STATE_STOP. Only one ScreenTapGesture object is created for each screen tap gesture recognized.
- setRotation — public method in class Leap.Matrix
-
Sets this transformation matrix to represent a rotation around the specified vector.
This function erases any previous rotation and scale transforms applied to this matrix, but does not affect translation.
- SwipeGesture — class in namespace Leap
-
The SwipeGesture class represents a swiping motion of a finger or tool.
Swipe gestures are continuous.
T Top
- times — public method in class Leap.Matrix
-
Multiply transform matrices.
Combines two transformations into a single equivalent transformation.
- toArray — public method in class Leap.Vector
-
Returns the vector as a float array.
- toArray3x3 — public method in class Leap.Matrix
-
Writes the 3x3 Matrix object to a 9 element row-major float array.
Translation factors are discarded.
- toArray4x4 — public method in class Leap.Matrix
-
Convert a 4x4 Matrix object to a 16 element row-major float array.
Translation factors are discarded.
- tool — public method in class Leap.Frame
-
The tool with the specified ID in this frame.
Use the Frame tool() function to retrieve a tool from this frame using an ID value obtained from a previous frame. This function always returns a Pointable object, but if no tool with the specified ID is present, an invalid Pointable object is returned.
Note that ID values persist across frames, but only until tracking of a particular object is lost. If tracking of a tool is lost and subsequently regained, the new Pointable object representing that tool may have a different ID than that representing the tool in an earlier frame.
- toString — public method in class Leap.Frame
-
A string containing a brief, human readable description of the Frame object.
- toString — public method in class Leap.Hand
-
A string containing a brief, human readable description of the Hand object.
- toString — public method in class Leap.Matrix
-
Write the matrix to a string in a human readable format.
- toString — public method in class Leap.Pointable
-
A string containing a brief, human readable description of the Pointable object.
- toString — public method in class Leap.Vector
-
Returns a string containing this vector in a human readable format: (x, y, z).
- transformDirection — public method in class Leap.Matrix
-
Transforms a vector with this matrix by transforming its rotation and scale only.
- transformPoint — public method in class Leap.Matrix
-
Transforms a vector with this matrix by transforming its rotation, scale, and translation.
Translation is applied after rotation and scale.
- translation — public method in class Leap.Frame
-
The change of position derived from the overall linear motion between the current frame and the specified frame.
The returned translation vector provides the magnitude and direction of the movement in millimeters.
The Leap derives frame translation from the linear motion of all objects detected in the field of view.
If either this frame or sinceFrame is an invalid Frame object, then this method returns a zero vector.
- translation — public method in class Leap.Hand
-
The change of position of this hand between the current frame and the specified frame
The returned translation vector provides the magnitude and direction of the movement in millimeters.
If a corresponding Hand object is not found in sinceFrame, or if either this frame or sinceFrame are invalid Frame objects, then this method returns a zero vector.
V Top
- Vector — class in namespace Leap
-
The Vector object represents a three-component mathematical vector or point such as a direction or position in three-dimensional space.
The Leap software employs a right-handed Cartesian coordinate system. Values given are in units of real-world millimeters. The origin is centered at the center of the Leap device. The x- and z-axes lie in the horizontal plane, with the x-axis running parallel to the long edge of the device. The y-axis is vertical, with positive values increasing upwards (in contrast to the downward orientation of most computer graphics coordinate systems). The z-axis has positive values increasing away from the computer screen.
Y Top
- yaw — public method in class Leap.Vector
-
The yaw angle in radians.
Yaw is the angle between the negative z-axis and the projection of the vector onto the x-z plane. In other words, yaw represents rotation around the y-axis. If the vector points to the right of the negative z-axis, then the returned angle is between 0 and pi radians (180 degrees); if it points to the left, the angle is between 0 and -pi radians.