Leap Motion C++ API Reference  0.8.0
Leap::Device Class Reference

The Device class represents a physically connected device. More...

Inherits Leap::Interface.

Public Member Functions

 Device ()
 Constructs a Device object.
 
float distanceToBoundary (const Vector &position) const
 The distance to the nearest edge of the Leap Motion controller's view volume.
 
float horizontalViewAngle () const
 The angle of view along the x axis of this device.
 
bool isValid () const
 Reports whether this is a valid Device object.
 
bool operator!= (const Device &) const
 Compare Device object inequality.
 
bool operator== (const Device &) const
 Compare Device object equality.
 
float range () const
 The maximum reliable tracking range.
 
std::string toString () const
 A string containing a brief, human readable description of the Device object.
 
float verticalViewAngle () const
 The angle of view along the z axis of this device.
 

Static Public Member Functions

static const Deviceinvalid ()
 Returns an invalid Device object.
 

Friends

std::ostream & operator<< (std::ostream &, const Device &)
 Writes a brief, human readable description of the Device object.
 

Detailed Description

The Device class represents a physically connected device.

The Device class contains information related to a particular connected device such as field of view, device id, and calibrated positions.

Note that Device objects can be invalid, which means that they do not contain valid device information and do not correspond to a physical device. Test for validity with the Device::isValid() function.

Constructor & Destructor Documentation

Leap::Device::Device ( )

Constructs a Device object.

An uninitialized device is considered invalid. Get valid Device objects from a DeviceList object obtained using the Controller::devices() method.

Member Function Documentation

float Leap::Device::distanceToBoundary ( const Vector position) const

The distance to the nearest edge of the Leap Motion controller's view volume.

The view volume is an axis-aligned, inverted pyramid centered on the device origin and extending upward to the range limit. The walls of the pyramid are described by the horizontalViewAngle and verticalViewAngle and the roof by the range. This function estimates the distance between the specified input position and the nearest wall or roof of the view volume.

Parameters
positionThe point to use for the distance calculation.
Returns
The distance in millimeters from the input position to the nearest boundary.
float Leap::Device::horizontalViewAngle ( ) const

The angle of view along the x axis of this device.

Leap_horizontalViewAngle.png

The Leap Motion controller scans a region in the shape of an inverted pyramid centered at the device's center and extending upwards. The horizontalViewAngle reports the view angle along the long dimension of the device.

Returns
The horizontal angle of view in radians.
static const Device& Leap::Device::invalid ( )
static

Returns an invalid Device object.

You can use the instance returned by this function in comparisons testing whether a given Device instance is valid or invalid. (You can also use the Device::isValid() function.)

Returns
The invalid Device instance.
bool Leap::Device::isValid ( ) const

Reports whether this is a valid Device object.

Returns
True, if this Device object contains valid data.
bool Leap::Device::operator!= ( const Device ) const

Compare Device object inequality.

Two Device objects are equal if and only if both Device objects represent the exact same Device and both Devices are valid.

bool Leap::Device::operator== ( const Device ) const

Compare Device object equality.

Two Device objects are equal if and only if both Device objects represent the exact same Device and both Devices are valid.

float Leap::Device::range ( ) const

The maximum reliable tracking range.

The range reports the maximum recommended distance from the device center for which tracking is expected to be reliable. This distance is not a hard limit. Tracking may be still be functional above this distance or begin to degrade slightly before this distance depending on calibration and extreme environmental conditions.

Returns
The recommended maximum range of the device in mm.
std::string Leap::Device::toString ( ) const

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

Returns
A description of the Device as a string.
float Leap::Device::verticalViewAngle ( ) const

The angle of view along the z axis of this device.

Leap_verticalViewAngle.png

The Leap Motion controller scans a region in the shape of an inverted pyramid centered at the device's center and extending upwards. The verticalViewAngle reports the view angle along the short dimension of the device.

Returns
The vertical angle of view in radians.

Friends And Related Function Documentation

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

Writes a brief, human readable description of the Device object.