18 "description":
"A floating-point 2-dimensional Cartesian spatial location.",
19 "keywords": [
"coordinate" ],
43 VuoPoint2d point = {0,0};
45 json_type t = json_object_get_type(js);
46 if (t == json_type_string)
48 const char *s = json_object_get_string(js);
50 sscanf(s,
"%20g, %20g", &x, &y);
51 return (VuoPoint2d){x, y};
53 else if (t == json_type_array)
55 int len = json_object_array_length(js);
57 point.x = json_object_get_double(json_object_array_get_idx(js, 0));
59 point.y = json_object_get_double(json_object_array_get_idx(js, 1));
65 if (json_object_object_get_ex(js,
"x", &o))
67 else if (json_object_object_get_ex(js,
"X", &o))
70 if (json_object_object_get_ex(js,
"y", &o))
72 else if (json_object_object_get_ex(js,
"Y", &o))
87 json_object_object_add(js,
"x", xObject);
90 json_object_object_add(js,
"y", yObject);
109 return fabs(value1.x - value2.x) < 0.00001
110 && fabs(value1.y - value2.y) < 0.00001;
124 min = max = points[0];
125 for (
unsigned long i = 1; i < count; ++i)
130 VuoPoint2d diff = max - min;
131 return diff.x <= tolerance.x
132 && diff.y <= tolerance.y;
153 return minimum.x <= value.x && value.x <= maximum.x
154 && minimum.y <= value.y && value.y <= maximum.y;
170 VuoPoint2d min = FLT_MAX;
171 for (
unsigned long i = 0; i < count; ++i)
175 *outputPosition = i + 1;
194 VuoPoint2d max = -FLT_MAX;
195 for (
unsigned long i = 0; i < count; ++i)
199 *outputPosition = i + 1;
218 VuoPoint2d divisor = count;
219 return sum / divisor;