Ejemplo n.º 1
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_VuoLeapHand) Hands,
		VuoInputData(VuoPoint3d, {"default":{"x":0, "y":0, "z":0}}) target,
		VuoOutputData(VuoList_VuoLeapHand) sortedHands
)
{
	*sortedHands = VuoListCreate_VuoLeapHand();

	int count = VuoListGetCount_VuoLeapHand(Hands);

	sortable_pointValue pointValues[count];

	for(int i = 0; i < count; i++)
		pointValues[i] = (sortable_pointValue){i, VuoPoint3d_squaredMagnitude(VuoPoint3d_subtract(VuoListGetValueAtIndex_VuoLeapHand(Hands, i+1).palmPosition, target))};

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

	for(int i = 0; i < count; i++)
		VuoListAppendValue_VuoLeapHand(*sortedHands, VuoListGetValueAtIndex_VuoLeapHand(Hands, pointValues[i].index+1) );
}
Ejemplo n.º 2
0
 */

#include "node.h"
#include "VuoLeapFrame.h"
#include "VuoLeapHand.h"
#include "VuoLeapPointable.h"
#include "VuoList_VuoLeapHand.h"
#include "VuoList_VuoLeapPointable.h"

VuoModuleMetadata({
					  "title" : "Get Frame Values",
					  "keywords" : [ "gesture", "controller", "motion", "hand", "palm", "pointable", "finger", "tool" ],
					  "version" : "1.0.0",
					  "node": {
						  "exampleCompositions" : [ "DisplayLeapHand.vuo", "HighlightExtendedFingers.vuo", "TwirlImageWithLeap.vuo" ]
					  }
				 });

void nodeEvent
(
		VuoInputData(VuoLeapFrame) frame,
		VuoOutputData(VuoInteger, {"name":"ID"}) id,
		VuoOutputData(VuoList_VuoLeapHand) hands,
		VuoOutputData(VuoList_VuoLeapPointable) pointables
)
{
	*id = frame.id;
	*hands = frame.hands ? frame.hands : VuoListCreate_VuoLeapHand();
	*pointables = frame.pointables ? frame.pointables : VuoListCreate_VuoLeapPointable();
}
Ejemplo n.º 3
0
VuoModuleMetadata({
					  "title" : "Find Hands by Confidence",
					  "keywords" : [ "controller", "motion", "hand", "palm", "accurate", "accuracy", "correct", "sort", "filter" ],
					  "version" : "2.0.0",
					  "node": {
						  "exampleCompositions" : [ ]
					  }
				  });


void nodeEvent
(
		VuoInputData(VuoList_VuoLeapHand) hands,
		VuoInputData(VuoReal, {"default":0.8, "suggestedMin":0.0, "suggestedMax":1.0, "suggestedStep":0.1}) confidence,
		VuoOutputData(VuoList_VuoLeapHand) foundHands
)
{
	*foundHands = VuoListCreate_VuoLeapHand();

	int count = VuoListGetCount_VuoLeapHand(hands);

	for(int i = 1; i < count+1; i++)
	{
		VuoLeapHand hand = VuoListGetValue_VuoLeapHand(hands, i);

		if(hand.confidence > confidence)
			VuoListAppendValue_VuoLeapHand(*foundHands, hand);
	}
}