Simulated Reality SDK 7500c78d v1.30.2.51085 2024-04-26T11:23:03Z
Stable
handpose.h
Go to the documentation of this file.
1
10#pragma once
11#include "sr/types.h"
12
13#include <math.h>
14
15#ifdef __cplusplus
21enum SR_handSide : uint64_t {
23 RightHand = 1
24};
25#else
26typedef uint64_t SR_handSide;
27#endif
28
34typedef union {
35 struct {
39 };
40 struct {
44 };
45 SR_point3d joints[3];
46} SR_thumb;
47
53typedef union {
54 struct {
59 };
60 struct {
65 };
66 SR_point3d joints[4];
67} SR_finger;
68
72#ifdef __cplusplus
73enum SR_handJoints : uint64_t {
74 Wrist = 0,
75 Palm = 1,
94 Pinky_Distal = 20
95};
96#else
97typedef uint64_t SR_handJoints;
98#endif
99
124typedef struct {
125 uint64_t frameId;
126 uint64_t time;
127 uint64_t handId;
129 union {
130 struct {
134 union {
135 struct {
140 };
141 SR_finger fingers[4];
142 };
143 };
144 SR_point3d joints[21];
145 };
147
151static float getGrabbing(SR_handPose pose) {
152 return 0;
153}
154
158static float getPinching(SR_handPose pose) {
159 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};
160 return (float)sqrt(d.x*d.x + d.y*d.y + d.z*d.z);
161}
SR_handSide
Enum used to specify a left or right hand type pose.
Definition: handpose.h:21
@ RightHand
Right hand.
Definition: handpose.h:23
@ LeftHand
Left hand.
Definition: handpose.h:22
static float getPinching(SR_handPose pose)
Determine whether a pose represents a pinching hand.
Definition: handpose.h:158
SR_handJoints
Enum used to identify joints in the hand.
Definition: handpose.h:73
@ Pinky_Distal
The end of the distal bone on the pinky (the pinky tip)
Definition: handpose.h:94
@ Ring_Proximal
The joint between the proximal and intermediate bone on the ring finger.
Definition: handpose.h:88
@ Pinky_Metacarpal
The joint between the metacarpal and proximal bone on the pinky (the pinky base)
Definition: handpose.h:91
@ Ring_Metacarpal
The joint between the metacarpal and proximal bone on the ring finger (the ring finger base)
Definition: handpose.h:87
@ Middle_Distal
The end of the distal bone on the middle finger (the middle finger tip)
Definition: handpose.h:86
@ Index_Metacarpal
The joint between the metacarpal and proximal bone on the index finger (the index finger base)
Definition: handpose.h:79
@ Thumb_Distal
The end of the distal bone on the thumb (the thumb tip)
Definition: handpose.h:78
@ Pinky_Intermediate
The joint between the intermediate and distal bone on the pinky.
Definition: handpose.h:93
@ Index_Distal
The end of the distal bone on the index finger (the index finger tip)
Definition: handpose.h:82
@ Index_Intermediate
The joint between the intermediate and distal bone on the index finger.
Definition: handpose.h:81
@ Thumb_Proximal
The joint between the proximal and distal bone on the thumb.
Definition: handpose.h:77
@ Pinky_Proximal
The joint between the proximal and intermediate bone on the pinky.
Definition: handpose.h:92
@ Middle_Intermediate
The joint between the intermediate and distal bone on the middle finger.
Definition: handpose.h:85
@ Ring_Intermediate
The joint between the intermediate and distal bone on the ring finger.
Definition: handpose.h:89
@ Middle_Metacarpal
The joint between the metacarpal and proximal bone on the middle finger (the middle finger base)
Definition: handpose.h:83
@ Thumb_Metacarpal
The joint between the metacarpal and proximal bone on the thumb (the thumb base)
Definition: handpose.h:76
@ Palm
The center of the palm.
Definition: handpose.h:75
@ Index_Proximal
The joint between the proximal and intermediate bone on the index finger.
Definition: handpose.h:80
@ Ring_Distal
The end of the distal bone on the ring finger (the ring finger tip)
Definition: handpose.h:90
@ Middle_Proximal
The joint between the proximal and intermediate bone on the middle finger.
Definition: handpose.h:84
@ Wrist
The wrist.
Definition: handpose.h:74
static float getGrabbing(SR_handPose pose)
Determine whether a pose represents a grabbing hand.
Definition: handpose.h:151
C-compatible struct containing the pose of a hand.
Definition: handpose.h:124
SR_point3d wrist
Absolute position of the wrist.
Definition: handpose.h:131
uint64_t time
Time from epoch in microseconds.
Definition: handpose.h:126
SR_point3d palm
Absolute position of the center of the palm.
Definition: handpose.h:132
SR_handSide side
Left or right hand.
Definition: handpose.h:128
SR_finger index
Index finger.
Definition: handpose.h:136
uint64_t handId
Hand identifier.
Definition: handpose.h:127
SR_finger middle
Middle finger.
Definition: handpose.h:137
SR_finger pinky
Pinky.
Definition: handpose.h:139
SR_thumb thumb
Thumb.
Definition: handpose.h:133
uint64_t frameId
Autoincrement frame number.
Definition: handpose.h:125
SR_finger ring
Ring finger.
Definition: handpose.h:138
C-compatible struct containing a part of the pose representing a finger.
Definition: handpose.h:53
SR_point3d metacarpal
Absolute position of the joint between the metacarpal and proximal bone (the base)
Definition: handpose.h:55
SR_point3d distal
Absolute position of the end of the distal bone (the tip)
Definition: handpose.h:58
SR_point3d c
intermediate alias
Definition: handpose.h:63
SR_point3d proximal
Absolute position of the joint between the proximal and intermediate bone.
Definition: handpose.h:56
SR_point3d b
proximal alias
Definition: handpose.h:62
SR_point3d intermediate
Absolute position of the joint between the intermediate and distal bone.
Definition: handpose.h:57
SR_point3d a
metacarpal alias
Definition: handpose.h:61
SR_point3d tip
distal alias
Definition: handpose.h:64
C-compatible struct containing the part of the pose representing a thumb.
Definition: handpose.h:34
SR_point3d b
proximal alias
Definition: handpose.h:42
SR_point3d distal
Absolute position of the end of the distal bone (the tip)
Definition: handpose.h:38
SR_point3d proximal
Absolute position of the joint between the proximal and distal bone.
Definition: handpose.h:37
SR_point3d tip
distal alias
Definition: handpose.h:43
SR_point3d a
metacarpal alias
Definition: handpose.h:41
SR_point3d metacarpal
Absolute position of the joint between the metacarpal and proximal bone (the base)
Definition: handpose.h:36
C-compatible 3d double vector representation.
Definition: types.h:81
double y
Second value in the 3d vector.
Definition: types.h:85
double z
Third value in the 3d vector.
Definition: types.h:86
double x
First value in the 3d vector.
Definition: types.h:84