Vuo  2.4.0
VuoLeapHand.c
Go to the documentation of this file.
1
10#include "type.h"
11#include "VuoLeapHand.h"
12
14#ifdef VUO_COMPILER
16 "title" : "Leap Hand",
17 "description" : "Data for a Leap Hand",
18 "keywords" : [ "gesture", "controller", "hand", "finger", "motion" ],
19 "version" : "1.0.0",
20 "dependencies" : [
21 "VuoInteger",
22 "VuoPoint3d",
23 "VuoPoint4d",
24 "VuoReal",
25 "VuoText",
26 "VuoLeapPointable",
27 "VuoList_VuoLeapPointable"
28 ]
29 });
30#endif
32
42{
43 return (VuoLeapHand){
45 VuoJson_getObjectValue(VuoPoint4d, js, "rotation", (VuoPoint4d){0,0,0,0}),
46 VuoJson_getObjectValue(VuoPoint3d, js, "palmPosition", (VuoPoint3d){0,0,0}),
47 VuoJson_getObjectValue(VuoPoint3d, js, "palmVelocity", (VuoPoint3d){0,0,0}),
48 VuoJson_getObjectValue(VuoReal, js, "sphereRadius", 0.),
49 VuoJson_getObjectValue(VuoPoint3d, js, "sphereCenter", (VuoPoint3d){0,0,0}),
50 VuoJson_getObjectValue(VuoReal, js, "palmWidth", 0.),
51 VuoJson_getObjectValue(VuoPoint3d, js, "wristPosition", (VuoPoint3d){0,0,0}),
52 VuoJson_getObjectValue(VuoReal, js, "pinchAmount", 0.),
53 VuoJson_getObjectValue(VuoReal, js, "grabAmount", 0.),
54 VuoJson_getObjectValue(VuoReal, js, "timeVisible", 0.),
55 VuoJson_getObjectValue(VuoBoolean, js, "isLeftHand", false),
56 VuoJson_getObjectValue(VuoReal, js, "confidence", 0.),
58 };
59}
60
66{
67 json_object *js = json_object_new_object();
68
69 json_object *idObject = VuoInteger_getJson(value.id);
70 json_object_object_add(js, "id", idObject);
71
72 json_object *rotationObject = VuoPoint4d_getJson(value.rotation);
73 json_object_object_add(js, "rotation", rotationObject);
74
75 json_object *palmPositionObject = VuoPoint3d_getJson(value.palmPosition);
76 json_object_object_add(js, "palmPosition", palmPositionObject);
77
78 json_object *palmVelocityObject = VuoPoint3d_getJson(value.palmVelocity);
79 json_object_object_add(js, "palmVelocity", palmVelocityObject);
80
81 json_object *sphereRadiusObject = VuoReal_getJson(value.sphereRadius);
82 json_object_object_add(js, "sphereRadius", sphereRadiusObject);
83
84 json_object *sphereCenterObject = VuoPoint3d_getJson(value.sphereCenter);
85 json_object_object_add(js, "sphereCenter", sphereCenterObject);
86
87 json_object *palmWidthObject = VuoReal_getJson(value.palmWidth);
88 json_object_object_add(js, "palmWidth", palmWidthObject);
89
90 json_object *wristPositionObject = VuoPoint3d_getJson(value.wristPosition);
91 json_object_object_add(js, "wristPosition", wristPositionObject);
92
93 json_object *pinchAmountObject = VuoReal_getJson(value.pinchAmount);
94 json_object_object_add(js, "pinchAmount", pinchAmountObject);
95
96 json_object *grabAmountObject = VuoReal_getJson(value.grabAmount);
97 json_object_object_add(js, "grabAmount", grabAmountObject);
98
99 json_object *timeVisibleObject = VuoReal_getJson(value.timeVisible);
100 json_object_object_add(js, "timeVisible", timeVisibleObject);
101
102 json_object *isLeftHandObject = VuoBoolean_getJson(value.isLeftHand);
103 json_object_object_add(js, "isLeftHand", isLeftHandObject);
104
105 json_object *confidenceObject = VuoReal_getJson(value.confidence);
106 json_object_object_add(js, "confidence", confidenceObject);
107
108 json_object *pointablesObject = VuoList_VuoLeapPointable_getJson(value.fingers);
109 json_object_object_add(js, "fingers", pointablesObject);
110
111 return js;
112}
113
119{
120 return VuoText_format("%lld", value.id);
121}
122
128 VuoPoint4d rotation,
129 VuoPoint3d palmPosition,
130 VuoPoint3d palmVelocity,
131 VuoReal sphereRadius,
132 VuoPoint3d sphereCenter,
133 VuoReal palmWidth,
134 VuoPoint3d wristPosition,
135 VuoReal pinchAmount,
136 VuoReal grabAmount,
137 VuoReal timeVisible,
138 VuoBoolean isLeftHand,
139 VuoReal confidence,
141{
142 VuoLeapHand hand;
143
144 hand.id = id;
145 hand.rotation = rotation;
146 hand.palmPosition = palmPosition;
147 hand.palmVelocity = palmVelocity;
148 hand.sphereRadius = sphereRadius;
149 hand.sphereCenter = sphereCenter;
150 hand.palmWidth = palmWidth;
151 hand.wristPosition = wristPosition;
152 hand.pinchAmount = pinchAmount;
153 hand.grabAmount = grabAmount;
154 hand.timeVisible = timeVisible;
155 hand.isLeftHand = isLeftHand;
156 hand.confidence = confidence;
157 hand.fingers = fingers;
158
159 return hand;
160}