LeapBoneΒΆ

LeapBone Class Reference

The LeapBone class represents a tracked bone. More...

Inherits NSObject.

Properties

LeapMatrixbasis
 The orientation of the bone as a basis matrix. More...
 
LeapVectorcenter
 The midpoint in the center of the bone. More...
 
LeapVectordirection
 The normalized direction of the bone from base to tip. More...
 
LeapBoneinvalid
 An invalid Bone object. More...
 
BOOL isValid
 Reports whether this is a valid LeapBone object. More...
 
float length
 The estimated length of the bone in millimeters. More...
 
LeapVectornextJoint
 The end of the bone farthest from the wrist. More...
 
LeapVectorprevJoint
 The end of the bone closest from the wrist. More...
 
LeapBoneType type
 The name of this bone. More...
 
float width
 The average width of the finger along this bone in millimeters. More...
 

Detailed Description

The LeapBone class represents a tracked bone.

All fingers contain 4 bones that make up the anatomy of the finger. Get valid LeapBone objects from a Finger object.

Bones are ordered from base to tip, indexed from 0 to 3. Additionally, the bone's LeapBoneType enum may be used to index a specific bone anatomically.

The thumb does not have a base metacarpal bone and therefore contains a valid, zero length bone at that location.

Note that LeapBone objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical bone. Invalid LeapBone objects can be the result of asking for a LeapBone object from an invalid finger, indexing a bone out of range, or constructing a new bone. Test for validity with the LeapBone.isValid property.

Since 2.0

Property Documentation

- (LeapMatrix*) basis
readnonatomicassign

The orientation of the bone as a basis matrix.

The basis is defined as follows: xAxis: Clockwise rotation axis of the bone yAxis: Positive above the bone zAxis: Positive along the bone towards the wrist

LeapMatrix *basis = bone.basis;

Note: Since the left hand is a mirror of the right hand, left handed bones will contain a left-handed basis.

Returns
The basis of the bone as a matrix.
Since
2.0
- (LeapVector*) center
readnonatomicassign

The midpoint in the center of the bone.

LeapVector *center = bone.center;
Returns
The midpoint in the center of the bone.
Since
2.0
- (LeapVector*) direction
readnonatomicassign

The normalized direction of the bone from base to tip.

LeapVector *direction = bone.direction;
Returns
The normalized direction of the bone from base to tip.
Since
2.0
- (LeapBone*) invalid
readnonatomicassign

An invalid Bone object.

You can use an invalid LeapBone object in comparisons testing whether a given LeapBone instance is valid or invalid. (You can also use the LeapBone.isValid property.)

- (LeapBone *)findBone:(NSString *) criteria
{
//Look up bone with criteria, else
return LeapBone.invalid;
}
Returns
The invalid LeapBone instance.
Since
2.0
- (BOOL) isValid
readnonatomicassign

Reports whether this is a valid LeapBone object.

if( bone.isValid){
//Use the bone...
}
Since
2.0
- (float) length
readnonatomicassign

The estimated length of the bone in millimeters.

float length = bone.length;
Returns
The length of the bone in millimeters.
Since
2.0
- (LeapVector*) nextJoint
readnonatomicassign

The end of the bone farthest from the wrist.

LeapVector *distalEnd = bone.nextJoint;
Returns
The LeapVector containing the coordinates of the next joint position (the joint or bone tip closest to the end of the finger).
Since
2.0
- (LeapVector*) prevJoint
readnonatomicassign

The end of the bone closest from the wrist.

LeapVector *proximalEnd = bone.prevJoint;
Returns
The LeapVector containing the coordinates of the previous joint position (the joint closer to the wrist).
Since
2.0
- (LeapBoneType) type
readnonatomicassign

The name of this bone.

LeapBoneType boneDesignator = bone.type;
Returns
The anatomical type of this bone as a member of the LeapBoneType enumeration.
Since
2.0
- (float) width
readnonatomicassign

The average width of the finger along this bone in millimeters.

float width = bone.width;
Returns
The average width of the bone including the surrounding flesh in millimeters.
Since
2.0