Example #1
0
					  "title" : "Find Minimum",
					  "keywords" : [ "less", "least", "small", "few", "low", "<", "bottom", "lower", "limit", "bound", "range" ],
					  "version" : "1.0.0",
					  "genericTypes" : {
						  "VuoGenericType1" : {
							  "defaultType" : "VuoReal",
							  "compatibleTypes" : [ "VuoInteger", "VuoReal" ]
						  }
					  },
					  "node": {
						  "isInterface" : false
					  }
				  });

void nodeEvent
(
		VuoInputData(VuoList_VuoGenericType1) terms,
		VuoOutputData(VuoGenericType1) min
)
{
	unsigned long termsCount = VuoListGetCount_VuoGenericType1(terms);

	VuoGenericType1 *termsArray = (VuoGenericType1 *)malloc(termsCount * sizeof(VuoGenericType1));
	for (unsigned long i = 0; i < termsCount; ++i)
		termsArray[i] = VuoListGetValueAtIndex_VuoGenericType1(terms, i+1);

	*min = VuoGenericType1_min(termsArray, termsCount);

	free(termsArray);
}
Example #2
0
 */

#include "node.h"

VuoModuleMetadata({
					 "title" : "Append Lists",
					 "keywords" : [ "concatenate", "combine", "join", "together", "merge" ],
					 "version" : "1.0.0",
					 "node" : {
						  "exampleCompositions" : [ "SpliceSquares.vuo" ]
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoList_VuoGenericType1) list1,
		VuoInputData(VuoList_VuoGenericType1) list2,
		VuoOutputData(VuoList_VuoGenericType1) combinedList
)
{
	*combinedList = VuoListCreate_VuoGenericType1();

	unsigned long list1Count = VuoListGetCount_VuoGenericType1(list1);
	for (unsigned long i = 1; i <= list1Count; ++i)
		VuoListAppendValue_VuoGenericType1(*combinedList, VuoListGetValue_VuoGenericType1(list1, i));

	unsigned long list2Count = VuoListGetCount_VuoGenericType1(list2);
	for (unsigned long i = 1; i <= list2Count; ++i)
		VuoListAppendValue_VuoGenericType1(*combinedList, VuoListGetValue_VuoGenericType1(list2, i));
}
Example #3
0
static int compare (const void * a, const void * b)
{
	sortable_pointValue *x = (sortable_pointValue*)a;
	sortable_pointValue *y = (sortable_pointValue*)b;

	return (x->value - y->value);
}

void nodeEvent
(
		VuoInputData(VuoList_VuoGenericType1) list,
		VuoInputData(VuoGenericType1, {"default":{"x":0, "y":0, "z":0, "w":0}}) point,
		VuoOutputData(VuoList_VuoGenericType1) sorted
)
{
	*sorted = VuoListCreate_VuoGenericType1();

	int count = VuoListGetCount_VuoGenericType1(list);

	sortable_pointValue pointValues[count];

	for(int i = 0; i < count; i++)
		pointValues[i] = (sortable_pointValue){i, fabs(VuoListGetValueAtIndex_VuoGenericType1(list, i+1).z - point.z)};

	qsort (pointValues, count, sizeof(sortable_pointValue), compare);

	for(int i = 0; i < count; i++)
		VuoListAppendValue_VuoGenericType1(*sorted, VuoListGetValueAtIndex_VuoGenericType1(list, pointValues[i].index+1) );
}