# LeapBone¶

Properties:

class LeapBone

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

- (LeapMatrix *) basis
basis

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.

Return
The basis of the bone as a matrix.
Since
2.0

- (LeapVector *) center
center

The midpoint in the center of the bone.

LeapVector *center = bone.center;


Return
The midpoint in the center of the bone.
Since
2.0

- (LeapVector *) direction
direction

The normalized direction of the bone from base to tip.

LeapVector *direction = bone.direction;


Return
The normalized direction of the bone from base to tip.
Since
2.0

- (LeapBone *) invalid
invalid

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;
}


Return
The invalid LeapBone instance.
Since
2.0

- (BOOL) isValid
isValid

Reports whether this is a valid LeapBone object.

if( bone.isValid){
//Use the bone...
}


Since
2.0

- (float) length
length

The estimated length of the bone in millimeters.

float length = bone.length;


Return
The length of the bone in millimeters.
Since
2.0

- (LeapVector *) nextJoint
nextJoint

The end of the bone farthest from the wrist.

LeapVector *distalEnd = bone.nextJoint;


Return
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
prevJoint

The end of the bone closest from the wrist.

LeapVector *proximalEnd = bone.prevJoint;


Return
The LeapVector containing the coordinates of the previous joint position (the joint closer to the wrist).
Since
2.0

- (LeapBoneType) type
type

The name of this bone.

LeapBoneType boneDesignator = bone.type;


Return
The anatomical type of this bone as a member of the LeapBoneType enumeration.
Since
2.0

- (float) width
width

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

float width = bone.width;


Return
The average width of the bone including the surrounding flesh in millimeters.
Since
2.0

## LeapBoneType¶

LeapBoneType enum

Enumerates the names of the bones.

Since 2.0

Values:

• LEAP_BONE_TYPE_METACARPAL = = 0 -

The metacarpal bone connecting to the wrist.

• LEAP_BONE_TYPE_PROXIMAL = = 1 -

The first finger phalanx bone.

• LEAP_BONE_TYPE_INTERMEDIATE = = 2 -

The middle finger phalanx bone.

• LEAP_BONE_TYPE_DISTAL = = 3 -

The finger phalanx bone at the end of the finger.