< GeeXLab Reference Guide />
> Back to Reference Guide Index
gh_leap library
Description
gh_leap is the module that manages the Leap Motion device.
Number of functions: 11
- gh_leap.get_device_name ()
- gh_leap.get_finger_bone_direction ()
- gh_leap.get_finger_bone_position ()
- gh_leap.get_hand_palm_angles ()
- gh_leap.get_hand_palm_normal ()
- gh_leap.get_hand_palm_position ()
- gh_leap.get_num_devices ()
- gh_leap.get_num_fingers ()
- gh_leap.get_num_hands ()
- gh_leap.is_connected ()
- gh_leap.update ()
get_device_name
Description
Returns the name of a particular device.
Syntax
dev_name = gh_leap.get_device_name(
dev_index
)
Languages
Parameters
- dev_index [INTEGER]: device index
Return Values
- dev_name [STRING]: device name
Code sample
name = gh_leap.get_device_name(0)
get_finger_bone_direction
Description
Gets the vector direction of a bone of a particular finger.
Syntax
dir_x, dir_y, dir_z = gh_leap.get_finger_bone_direction(
hand_index,
fing_index,
bone_index
)
Languages
Parameters
- hand_index [INTEGER]: hand index
- fing_index [INTEGER]: finger index
- bone_index [INTEGER]: bone index
Return Values
- dir_x, dir_y, dir_z [REAL]: direction vector
Code sample
dir_x, dir_y, dir_z = gh_leap.get_finger_bone_direction(hand_index, finger_index, bone_index)
get_finger_bone_position
Description
Gets the position of a bone of a particular finger.
Syntax
end_x, end_y, end_z, start_x, start_y, start_z = gh_leap.get_finger_bone_position(
hand_index,
fing_index,
bone_index
)
Languages
Parameters
- hand_index [INTEGER]: hand index
- fing_index [INTEGER]: finger index
- bone_index [INTEGER]: bone index
Return Values
- end_x, end_y, end_z [REAL]: end position of the bone
- start_x, start_y, start_z [REAL]: start position of the bone
Code sample
start_x, start_y, start_z, end_x, end_y, end_z = gh_leap.get_finger_bone_position(hand_index, finger_index, bone_index)
get_hand_palm_angles
Description
Gets the plam euler angles for a particular hand.
Syntax
pitch, yaw, roll = gh_leap.get_hand_palm_angles(
hand_index
)
Languages
Parameters
- hand_index [INTEGER]: hand index
Return Values
- pitch, yaw, roll [REAL]: Euler's angles
Code sample
pitch, yaw, roll = gh_leap.get_hand_palm_angles(hand)
get_hand_palm_normal
Description
Gets the plam normal vector for a particular hand.
Syntax
x, y, z = gh_leap.get_hand_palm_normal(
hand_index
)
Languages
Parameters
- hand_index [INTEGER]: hand index
Return Values
- x, y, z [REAL]: normal vector
Code sample
x,y,z = gh_leap.get_hand_palm_normal(hand)
get_hand_palm_position
Description
Gets the plam position for a particular hand.
Syntax
x, y, z = gh_leap.get_hand_palm_position(
hand_index
)
Languages
Parameters
- hand_index [INTEGER]: hand index
Return Values
Code sample
x,y,z = gh_leap.get_hand_palm_position(hand)
get_num_devices
Description
Returns the number of devices.
Syntax
num_devices = gh_leap.get_num_devices()
Languages
Parameters
This function has no input parameter(s).
Return Values
- num_devices [INTEGER]: number of devices
Code sample
n = gh_leap.get_num_devices()
get_num_fingers
Description
Returns the numbers of fingers for a particular hand.
Syntax
num_fingers = gh_leap.get_num_fingers(
hand_index
)
Languages
Parameters
- hand_index [INTEGER]: hand index
Return Values
- num_fingers [INTEGER]: number of fingers
Code sample
fingers = gh_leap.get_num_fingers(hand)
get_num_hands
Description
Returns the numbers of hands.
Syntax
num_hands = gh_leap.get_num_hands()
Languages
Parameters
This function has no input parameter(s).
Return Values
- num_hands [INTEGER]: number of hands
Code sample
hands = gh_leap.get_num_hands()
is_connected
Description
Checks if a LeapMotion device is connected.
Syntax
ret = gh_leap.is_connected()
Languages
Parameters
This function has no input parameter(s).
Return Values
- ret [BOOLEAN]: connected: 1 (true) or 0 (false)
Code sample
state = gh_leap.is_connected()
update
Description
Updates the Leap Motion engine. Call it once per frame.
Syntax
gh_leap.update()
Languages
Parameters
This function has no input parameter(s).
Return Values
This function has no return value(s).
Code sample
gh_leap.update()
| |