Vuo  2.0.0
VuoDistribution3d.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoDistribution3d.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "3D Distribution",
18  "description" : "A distribution of points in 3D space.",
19  "keywords" : [ ],
20  "version" : "1.0.0",
21  "dependencies" : [
22  "VuoList_VuoDistribution3d"
23  ]
24  });
25 #endif
26 
36 {
37  const char *valueAsString = "";
38  if (json_object_get_type(js) == json_type_string)
39  valueAsString = json_object_get_string(js);
40 
41  VuoDistribution3d value = VuoDistribution3d_CubeVolume;
42 
43  if (strcmp(valueAsString, "cube-surface") == 0)
44  value = VuoDistribution3d_CubeSurface;
45  else if (strcmp(valueAsString, "sphere-volume") == 0)
46  value = VuoDistribution3d_SphereVolume;
47  else if (strcmp(valueAsString, "sphere-surface") == 0)
48  value = VuoDistribution3d_SphereSurface;
49 
50  return value;
51 }
52 
57 {
58  char *valueAsString = "cube-volume";
59 
60  if (value == VuoDistribution3d_CubeSurface)
61  valueAsString = "cube-surface";
62  else if (value == VuoDistribution3d_SphereVolume)
63  valueAsString = "sphere-volume";
64  else if (value == VuoDistribution3d_SphereSurface)
65  valueAsString = "sphere-surface";
66 
67  return json_object_new_string(valueAsString);
68 }
69 
74 {
76  VuoListAppendValue_VuoDistribution3d(l, VuoDistribution3d_CubeVolume);
77  VuoListAppendValue_VuoDistribution3d(l, VuoDistribution3d_CubeSurface);
78  VuoListAppendValue_VuoDistribution3d(l, VuoDistribution3d_SphereVolume);
79  VuoListAppendValue_VuoDistribution3d(l, VuoDistribution3d_SphereSurface);
80  return l;
81 }
82 
87 {
88  char *valueAsString = "Cube Volume";
89 
90  if (value == VuoDistribution3d_CubeSurface)
91  valueAsString = "Cube Surface";
92  else if (value == VuoDistribution3d_SphereVolume)
93  valueAsString = "Sphere Volume";
94  else if (value == VuoDistribution3d_SphereSurface)
95  valueAsString = "Sphere Surface";
96 
97  return strdup(valueAsString);
98 }
99 
104 {
105  return valueA == valueB;
106 }
107 
112 {
113  return valueA < valueB;
114 }
115