Vuo  2.3.2
VuoLeapPointable.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoLeapPointable.h"
12 
14 #ifdef VUO_COMPILER
16  "title" : "Leap Pointable",
17  "description" : "Struct of LeapPointable data.",
18  "keywords" : ["gesture", "controller", "motion", "hand", "finger", "pointable"],
19  "version" : "1.0.0",
20  "dependencies" : [
21  "VuoInteger",
22  "VuoLeapPointableType",
23  "VuoLeapTouchZone",
24  "VuoPoint3d",
25  "VuoReal",
26  "VuoText"
27  ]
28  });
29 #endif
31 
53 {
54  return (VuoLeapPointable){
55  VuoJson_getObjectValue(VuoInteger, js, "id", -1),
56  VuoJson_getObjectValue(VuoInteger, js, "type", VuoLeapPointableType_Finger),
57  VuoJson_getObjectValue(VuoReal, js, "length", 0),
58  VuoJson_getObjectValue(VuoReal, js, "width", 0),
59  VuoJson_getObjectValue(VuoPoint3d, js, "direction", (VuoPoint3d){0,0,0}),
60  VuoJson_getObjectValue(VuoPoint3d, js, "tipPosition", (VuoPoint3d){0,0,0}),
61  VuoJson_getObjectValue(VuoPoint3d, js, "tipVelocity", (VuoPoint3d){0,0,0}),
62  VuoJson_getObjectValue(VuoReal, js, "timeVisible", 0),
63  VuoJson_getObjectValue(VuoReal, js, "touchDistance", 0),
64  VuoJson_getObjectValue(VuoLeapTouchZone, js, "touchZone", VuoLeapTouchZone_None),
65  VuoJson_getObjectValue(VuoBoolean, js, "isExtended", false)
66  };
67 }
68 
74 {
75  json_object *js = json_object_new_object();
76 
77  json_object *idObject = VuoInteger_getJson(value.id);
78  json_object_object_add(js, "id", idObject);
79 
80  json_object *typeObject = VuoInteger_getJson(value.type);
81  json_object_object_add(js, "type", typeObject);
82 
83  json_object *lengthObject = VuoReal_getJson(value.length);
84  json_object_object_add(js, "length", lengthObject);
85 
86  json_object *widthObject = VuoReal_getJson(value.width);
87  json_object_object_add(js, "width", widthObject);
88 
89  json_object *directionObject = VuoPoint3d_getJson(value.direction);
90  json_object_object_add(js, "direction", directionObject);
91 
92  json_object *tipPositionObject = VuoPoint3d_getJson(value.tipPosition);
93  json_object_object_add(js, "tipPosition", tipPositionObject);
94 
95  json_object *tipVelocityObject = VuoPoint3d_getJson(value.tipVelocity);
96  json_object_object_add(js, "tipVelocity", tipVelocityObject);
97 
98  json_object *timeVisibleObject = VuoReal_getJson(value.timeVisible);
99  json_object_object_add(js, "timeVisible", timeVisibleObject);
100 
101  json_object *touchDistanceObject = VuoReal_getJson(value.touchDistance);
102  json_object_object_add(js, "touchDistance", touchDistanceObject);
103 
104  json_object *touchZoneObject = VuoInteger_getJson(value.touchZone);
105  json_object_object_add(js, "touchZone", touchZoneObject);
106 
107  json_object *isExtendedObject = VuoBoolean_getJson(value.isExtended);
108  json_object_object_add(js, "isExtended", isExtendedObject);
109 
110  return js;
111 }
112 
118 {
119  return VuoText_format("%lld", value.id);
120 }
121 
127  VuoInteger id,
129  VuoReal length,
130  VuoReal width,
131  VuoPoint3d direction,
132  VuoPoint3d tipPosition,
133  VuoPoint3d tipVelocity,
134  VuoReal timeVisible,
135  VuoReal touchDistance,
136  VuoLeapTouchZone touchZone,
137  VuoBoolean isExtended)
138 {
139  VuoLeapPointable pointable;
140 
141  pointable.id = id;
142  pointable.type = type;
143  pointable.length = length;
144  pointable.width = width;
145  pointable.direction = direction;
146  pointable.tipPosition = tipPosition;
147  pointable.tipVelocity = tipVelocity;
148  pointable.timeVisible = timeVisible;
149  pointable.touchDistance = touchDistance;
150  pointable.touchZone = touchZone;
151  pointable.isExtended = isExtended;
152 
153  return pointable;
154 }