# Bone¶

Bone Class Reference

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

Inherited by Arm.

## Public Types

enum  BoneType
Enumerates the names of the bones. More...

## Public Member Functions

Bone ()
Constructs a default Bone object. More...

Bone (Vector prevJoint, Vector nextJoint, Vector center, Vector direction, float length, float width, Bone.BoneType type, LeapQuaternion rotation)
Constructs a new Bone object. More...

bool Equals (Bone other)
Compare Bone object equality. More...

override string ToString ()
A string containing a brief, human readable description of the Bone object. More...

## Public Attributes

Vector Center
The midpoint of the bone. More...

Vector Direction
The normalized direction of the bone from base to tip. More...

float Length
The estimated length of the bone in millimeters. More...

Vector NextJoint
The end of the bone, closest to the finger tip. More...

Vector PrevJoint
The base of the bone, closest to the wrist. More...

LeapQuaternion Rotation
The orientation of this Bone as a Quaternion. More...

Bone.BoneType Type
The name of this bone. More...

float Width
The average width of the flesh around the bone in millimeters. More...

## Properties

LeapTransform Basis [get]
The orthonormal basis vectors for this Bone as a Matrix. More...

## Detailed Description

The Bone class represents a tracked bone.

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

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

List<Finger> fingers = hand.Fingers;
foreach(Finger finger in fingers){
Bone bone;
foreach (Bone.BoneType boneType in (Bone.BoneType[]) Enum.GetValues(typeof(Bone.BoneType)))
{
bone = finger.Bone(boneType);
// ... Use bone
}
}

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

Since
2.0

## Member Enumeration Documentation

 enum BoneType
strong

Enumerates the names of the bones.

Members of this enumeration are returned by Bone::type() to identify a Bone object.

Since
2.0

## Constructor & Destructor Documentation

 Bone ( )

Constructs a default Bone object.

Since
2.0
 Bone ( Vector prevJoint, Vector nextJoint, Vector center, Vector direction, float length, float width, Bone.BoneType type, LeapQuaternion rotation )

Constructs a new Bone object.

Parameters
 prevJoint The proximal end of the bone (closest to the body) nextJoint The distal end of the bone (furthest from the body) center The midpoint of the bone direction The unit direction vector pointing from prevJoint to nextJoint. length The estimated length of the bone. width The estimated average width of the bone. type The type of finger bone. basis The matrix representing the orientation of the bone.
Since
3.0

## Member Function Documentation

 bool Equals ( Bone other )

Compare Bone object equality.

Two Bone objects are equal if and only if both Bone objects represent the exact same physical bone in the same frame and both Bone objects are valid.

Since
2.0
 override string ToString ( )

A string containing a brief, human readable description of the Bone object.

String description = bone.ToString();
Returns
A description of the Bone object as a string.
Since
2.0

## Member Data Documentation

 Vector Center

The midpoint of the bone.

Vector middle = bone.Center;
Returns
The midpoint in the center of the bone.
Since
2.0
 Vector Direction

The normalized direction of the bone from base to tip.

Vector direction = bone.Direction;
Returns
The normalized direction of the bone from base to tip.
Since
2.0
 float Length

The estimated length of the bone in millimeters.

float length = bone.Length;
Returns
The length of the bone in millimeters.
Since
2.0
 Vector NextJoint

The end of the bone, closest to the finger tip.

In anatomical terms, this is the distal end of the bone.

Vector boneEnd = bone.NextJoint;
Returns
The Vector containing the coordinates of the next joint position.
Since
2.0
 Vector PrevJoint

The base of the bone, closest to the wrist.

In anatomical terms, this is the proximal end of the bone.

Vector boneStart = bone.PrevJoint;
Returns
The Vector containing the coordinates of the previous joint position.
Since
2.0
 LeapQuaternion Rotation

The orientation of this Bone as a Quaternion.

Returns
The Quaternion.
Since
2.0
 Bone.BoneType Type

The name of this bone.

Bone.BoneType type = bone.Type;
Returns
The anatomical type of this bone as a member of the Bone::Type enumeration.
Since
2.0
 float Width

The average width of the flesh around the bone in millimeters.

float width = bone.Width;
Returns
The width of the flesh around the bone in millimeters.
Since
2.0

## Property Documentation

 LeapTransform Basis
get

The orthonormal basis vectors for this Bone as a Matrix.

The orientation of this Bone as a Quaternion.

Basis vectors specify the orientation of a bone.

xBasis Perpendicular to the longitudinal axis of the bone; exits the sides of the finger.

yBasis or up vector Perpendicular to the longitudinal axis of the bone; exits the top and bottom of the finger. More positive in the upward direction.

zBasis Aligned with the longitudinal axis of the bone. More positive toward the base of the finger.

The bases provided for the right hand use the right-hand rule; those for the left hand use the left-hand rule. Thus, the positive direction of the x-basis is to the right for the right hand and to the left for the left hand. You can change from right-hand to left-hand rule by multiplying the z basis vector by -1.

You can use the basis vectors for such purposes as measuring complex finger poses and skeletal animation.

Note that converting the basis vectors directly into a quaternion representation is not mathematically valid. If you use quaternions, create them from the derived rotation matrix not directly from the bases.

LeapTransform basis = bone.Basis;
Vector xBasis = basis.xBasis;
Vector yBasis = basis.yBasis;
Vector zBasis = basis.zBasis;
Returns
The basis of the bone as a matrix.
The Quaternion.
Since
2.0