ArmΒΆ

The Arm class represents the forearm. More...

Inherits Interface.

Public Member Functions

 Arm (HandImplementation *)
 
 Arm ()
 Constructs an invalid Arm object. More...
 
Matrix basis () const
 The orthonormal basis vectors for the Arm bone as a Matrix. More...
 
Vector center () const
 The center of the forearm. More...
 
Vector direction () const
 The normalized direction in which the arm is pointing (from elbow to wrist). More...
 
Vector elbowPosition () const
 The position of the elbow. More...
 
bool isValid () const
 Reports whether this is a valid Arm object. More...
 
bool operator!= (const Arm &) const
 Compare Arm object inequality. More...
 
bool operator== (const Arm &) const
 Compare Arm object equality. More...
 
std::string toString () const
 A string containing a brief, human readable description of the Arm object. More...
 
float width () const
 The average width of the arm. More...
 
Vector wristPosition () const
 The position of the wrist. More...
 

Static Public Member Functions

static const Arminvalid ()
 Returns an invalid Arm object. More...
 

Friends

std::ostream & operator<< (std::ostream &, const Arm &)
 Writes a brief, human readable description of the Arm object to an output stream. More...
 

Detailed Description

The Arm class represents the forearm.

Constructor & Destructor Documentation

Arm ( HandImplementation *  )
Arm ( )

Constructs an invalid Arm object.

Get valid Arm objects from a Hand object.

Leap::Hand hand = frame.hands().frontmost();
Leap::Arm arm = hand.arm();
Since
2.0.3

Member Function Documentation

Matrix basis ( ) const

The orthonormal basis vectors for the Arm bone as a Matrix.

Basis vectors specify the orientation of a bone.

xBasis Perpendicular to the longitudinal axis of the bone; exits the arm laterally through the sides of the wrist.

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

zBasis Aligned with the longitudinal axis of the arm bone. More positive toward the wrist.

Leap::Vector xBasis = basis.xBasis;
Leap::Vector yBasis = basis.yBasis;
Leap::Vector zBasis = basis.zBasis;
Leap::Vector armCenter = arm.elbowPosition() +
(arm.wristPosition() - arm.elbowPosition()) * .5;
Leap::Matrix transform = Leap::Matrix(xBasis, yBasis, zBasis, armCenter);

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 z basis vector by -1.

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.

Returns
The basis of the arm bone as a matrix.
Since
2.0.3
Vector center ( ) const

The center of the forearm.

This location represents the midpoint of the arm between the wrist position and the elbow position.

Since
2.1.0
Vector direction ( ) const

The normalized direction in which the arm is pointing (from elbow to wrist).

Since
2.0.3
Vector elbowPosition ( ) const

The position of the elbow.

If not in view, the elbow position is estimated based on typical human anatomical proportions.

Since
2.0.3
static const Arm& invalid ( )
static

Returns an invalid Arm object.

Returns
The invalid Arm instance.
Since
2.0.3
bool isValid ( ) const

Reports whether this is a valid Arm object.

Leap::Arm arm = frame.hand(handID).arm();
if(arm.isValid())
{
// ... Use the arm data
}
Returns
True, if this Arm object contains valid tracking data.
Since
2.0.3
bool operator!= ( const Arm ) const

Compare Arm object inequality.

thisArm != thatArm;

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

Since
2.0.3
bool operator== ( const Arm ) const

Compare Arm object equality.

thisArm == thatArm;

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

Since
2.0.3
std::string toString ( ) const
inline

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

std::string description = arm.toString();
Returns
A description of the Arm object as a string.
Since
2.0.3
float width ( ) const

The average width of the arm.

float width = arm.width();
Since
2.0.3
Vector wristPosition ( ) const

The position of the wrist.

Note that the wrist position is not collocated with the end of any bone in the hand. There is a gap of a few centimeters since the carpal bones are not included in the skeleton model.

Since
2.0.3

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const Arm  
)
friend

Writes a brief, human readable description of the Arm object to an output stream.

std::cout << arm << std::endl;
Since
2.0.3