18 "description" :
"A floating-point 3-dimensional Cartesian spatial location.",
19 "keywords" : [
"coordinate" ],
44 VuoPoint3d point = {0,0,0};
46 json_type t = json_object_get_type(js);
47 if (t == json_type_string)
49 const char *s = json_object_get_string(js);
51 sscanf(s,
"%20g, %20g, %20g", &x, &y, &z);
52 return (VuoPoint3d){x, y, z};
54 else if (t == json_type_array)
56 int len = json_object_array_length(js);
58 point.x = json_object_get_double(json_object_array_get_idx(js, 0));
60 point.y = json_object_get_double(json_object_array_get_idx(js, 1));
62 point.z = json_object_get_double(json_object_array_get_idx(js, 2));
68 if (json_object_object_get_ex(js,
"x", &o))
69 point.x = json_object_get_double(o);
70 else if (json_object_object_get_ex(js,
"X", &o))
71 point.x = json_object_get_double(o);
73 if (json_object_object_get_ex(js,
"y", &o))
74 point.y = json_object_get_double(o);
75 else if (json_object_object_get_ex(js,
"Y", &o))
76 point.y = json_object_get_double(o);
78 if (json_object_object_get_ex(js,
"z", &o))
79 point.z = json_object_get_double(o);
80 else if (json_object_object_get_ex(js,
"Z", &o))
81 point.z = json_object_get_double(o);
94 json_object *xObject = json_object_new_double(value.x);
95 json_object_object_add(js,
"x", xObject);
97 json_object *yObject = json_object_new_double(value.y);
98 json_object_object_add(js,
"y", yObject);
100 json_object *zObject = json_object_new_double(value.z);
101 json_object_object_add(js,
"z", zObject);