class Leap.Arm

The Arm class represents a tracked arm.

Note that Arm objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical arm. Invalid Arm objects can be the result of asking for an Arm object from an invalid Hand object. An Arm object created with the Arm constructor is also invalid. Test for validity with the Arm.is_valid() attribute.

New in version 2.0.3.

classmethod Arm()

Constructs an invalid Arm object.

Get valid Arm objects from a Hand object.

hand = frame.hands.frontmost
arm = hand.arm
Return type:Arm

New in version 2.0.3.


The orthonormal basis vectors for this Arm as a Matrix.

Basis vectors specify the orientation of a arm.

  • x_basis. Perpendicular to the longitudinal axis of the arm; exits leterally through the sides of the wrist.
  • y_basis or up vector. Perpendicular to the longitudinal axis of the arm; exits the top and bottom of the arm. More positive in the upward direction.
  • z_basis. Aligned with the longitudinal axis of the arm. More positive toward the elbow.
basis = arm.basis
x_basis = basis.x_basis
y_basis = basis.y_basis
z_basis = basis.z_basis
center = arm.elbow_position + (arm.wrist_position - arm.elbow_position) * .05

arm_transform = Leap.Matrix(x_basis, y_basis, z_basis, center)

The bases provided for the right arm use the right-hand rule; those for the left arm use the left-hand rule. Thus, the positive direction of the x-basis is to the right for the right arm and to the left for the left arm. You can change from right-hand to left-hand rule by multiplying the basis vectors 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.

New in version 2.0.3.


The normalized direction of the arm from elbow to wrist.

direction = arm.direction

New in version 2.0.3.


The position of the elbow.

elbow = arm.elbow_position

New in version 2.0.3.


Reports whether this Arm object contains valid data.

arm = frame.hand(20).arm
    # ... Use the arm data

New in version 2.0.3.


The average width of the arm.

width = arm.width

displacement = arm.wrist_position - arm.elbow_position;
length = displacement.magnitude

New in version 2.0.3.


The position of the wrist.

wrist = arm.wrist_position

New in version 2.0.3.


An invalid Arm object.

arm = Leap.Arm.invalid

New in version 2.0.3.