Arm¶
Attributes:
- 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.
- basis¶
Type: Matrix 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.
- direction¶
Type: Vector The normalized direction of the arm from elbow to wrist.
direction = arm.direction
New in version 2.0.3.
- elbow_position¶
Type: Vector The position of the elbow.
elbow = arm.elbow_position
New in version 2.0.3.
- is_valid¶
Type: boolean Reports whether this Arm object contains valid data.
arm = frame.hand(20).arm if(arm.is_valid): # ... Use the arm data
New in version 2.0.3.
- width¶
Type: float 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.