LeiaSR SDK 720218b2 v1.32.7.6322 2025-02-13T14:55:38Z
Stable
handpose.h
Go to the documentation of this file.
1
5#pragma once
6#include "sr/types.h"
7
8#include <math.h>
9
10#ifdef __cplusplus
16enum SR_handSide : uint64_t {
18 RightHand = 1
19};
20#else
21typedef uint64_t SR_handSide;
22#endif
23
29typedef union {
30 struct {
34 };
35 struct {
39 };
40 SR_point3d joints[3];
41} SR_thumb;
42
48typedef union {
49 struct {
54 };
55 struct {
60 };
61 SR_point3d joints[4];
62} SR_finger;
63
67#ifdef __cplusplus
68enum SR_handJoints : uint64_t {
69 Wrist = 0,
70 Palm = 1,
89 Pinky_Distal = 20
90};
91#else
92typedef uint64_t SR_handJoints;
93#endif
94
119typedef struct {
120 uint64_t frameId;
121 uint64_t time;
122 uint64_t handId;
124 union {
125 struct {
129 union {
130 struct {
135 };
136 SR_finger fingers[4];
137 };
138 };
139 SR_point3d joints[21];
140 };
142
146static float getGrabbing(SR_handPose pose) {
147 return 0;
148}
149
153static float getPinching(SR_handPose pose) {
154 SR_point3d d = {pose.index.tip.x - pose.thumb.tip.x, pose.index.tip.y - pose.thumb.tip.y, pose.index.tip.z - pose.thumb.tip.z};
155 return (float)sqrt(d.x*d.x + d.y*d.y + d.z*d.z);
156}
SR_handSide
Enum used to specify a left or right hand type pose.
Definition: handpose.h:16
@ RightHand
Right hand.
Definition: handpose.h:18
@ LeftHand
Left hand.
Definition: handpose.h:17
static float getPinching(SR_handPose pose)
Determine whether a pose represents a pinching hand.
Definition: handpose.h:153
SR_handJoints
Enum used to identify joints in the hand.
Definition: handpose.h:68
@ Pinky_Distal
The end of the distal bone on the pinky (the pinky tip)
Definition: handpose.h:89
@ Ring_Proximal
The joint between the proximal and intermediate bone on the ring finger.
Definition: handpose.h:83
@ Pinky_Metacarpal
The joint between the metacarpal and proximal bone on the pinky (the pinky base)
Definition: handpose.h:86
@ Ring_Metacarpal
The joint between the metacarpal and proximal bone on the ring finger (the ring finger base)
Definition: handpose.h:82
@ Middle_Distal
The end of the distal bone on the middle finger (the middle finger tip)
Definition: handpose.h:81
@ Index_Metacarpal
The joint between the metacarpal and proximal bone on the index finger (the index finger base)
Definition: handpose.h:74
@ Thumb_Distal
The end of the distal bone on the thumb (the thumb tip)
Definition: handpose.h:73
@ Pinky_Intermediate
The joint between the intermediate and distal bone on the pinky.
Definition: handpose.h:88
@ Index_Distal
The end of the distal bone on the index finger (the index finger tip)
Definition: handpose.h:77
@ Index_Intermediate
The joint between the intermediate and distal bone on the index finger.
Definition: handpose.h:76
@ Thumb_Proximal
The joint between the proximal and distal bone on the thumb.
Definition: handpose.h:72
@ Pinky_Proximal
The joint between the proximal and intermediate bone on the pinky.
Definition: handpose.h:87
@ Middle_Intermediate
The joint between the intermediate and distal bone on the middle finger.
Definition: handpose.h:80
@ Ring_Intermediate
The joint between the intermediate and distal bone on the ring finger.
Definition: handpose.h:84
@ Middle_Metacarpal
The joint between the metacarpal and proximal bone on the middle finger (the middle finger base)
Definition: handpose.h:78
@ Thumb_Metacarpal
The joint between the metacarpal and proximal bone on the thumb (the thumb base)
Definition: handpose.h:71
@ Palm
The center of the palm.
Definition: handpose.h:70
@ Index_Proximal
The joint between the proximal and intermediate bone on the index finger.
Definition: handpose.h:75
@ Ring_Distal
The end of the distal bone on the ring finger (the ring finger tip)
Definition: handpose.h:85
@ Middle_Proximal
The joint between the proximal and intermediate bone on the middle finger.
Definition: handpose.h:79
@ Wrist
The wrist.
Definition: handpose.h:69
static float getGrabbing(SR_handPose pose)
Determine whether a pose represents a grabbing hand.
Definition: handpose.h:146
C-compatible struct containing the pose of a hand.
Definition: handpose.h:119
SR_point3d wrist
Absolute position of the wrist.
Definition: handpose.h:126
uint64_t time
Time from epoch in microseconds.
Definition: handpose.h:121
SR_point3d palm
Absolute position of the center of the palm.
Definition: handpose.h:127
SR_handSide side
Left or right hand.
Definition: handpose.h:123
SR_finger index
Index finger.
Definition: handpose.h:131
uint64_t handId
Hand identifier.
Definition: handpose.h:122
SR_finger middle
Middle finger.
Definition: handpose.h:132
SR_finger pinky
Pinky.
Definition: handpose.h:134
SR_thumb thumb
Thumb.
Definition: handpose.h:128
uint64_t frameId
Autoincrement frame number.
Definition: handpose.h:120
SR_finger ring
Ring finger.
Definition: handpose.h:133
C-compatible struct containing a part of the pose representing a finger.
Definition: handpose.h:48
SR_point3d metacarpal
Absolute position of the joint between the metacarpal and proximal bone (the base)
Definition: handpose.h:50
SR_point3d distal
Absolute position of the end of the distal bone (the tip)
Definition: handpose.h:53
SR_point3d c
intermediate alias
Definition: handpose.h:58
SR_point3d proximal
Absolute position of the joint between the proximal and intermediate bone.
Definition: handpose.h:51
SR_point3d b
proximal alias
Definition: handpose.h:57
SR_point3d intermediate
Absolute position of the joint between the intermediate and distal bone.
Definition: handpose.h:52
SR_point3d a
metacarpal alias
Definition: handpose.h:56
SR_point3d tip
distal alias
Definition: handpose.h:59
C-compatible struct containing the part of the pose representing a thumb.
Definition: handpose.h:29
SR_point3d b
proximal alias
Definition: handpose.h:37
SR_point3d distal
Absolute position of the end of the distal bone (the tip)
Definition: handpose.h:33
SR_point3d proximal
Absolute position of the joint between the proximal and distal bone.
Definition: handpose.h:32
SR_point3d tip
distal alias
Definition: handpose.h:38
SR_point3d a
metacarpal alias
Definition: handpose.h:36
SR_point3d metacarpal
Absolute position of the joint between the metacarpal and proximal bone (the base)
Definition: handpose.h:31
C-compatible 3d double vector representation.
Definition: types.h:73
double y
Second value in the 3d vector.
Definition: types.h:77
double z
Third value in the 3d vector.
Definition: types.h:78
double x
First value in the 3d vector.
Definition: types.h:76