16 #pragma clang diagnostic push
17 #pragma clang diagnostic ignored "-Wdocumentation"
19 #pragma clang diagnostic pop
32 "VuoList_VuoLeapHand",
33 "VuoList_VuoLeapPointable",
48 return (millimeters / ibox.width()) * 2.;
71 case Leap::Pointable::ZONE_TOUCHING:
72 return VuoLeapTouchZone_Touching;
74 case Leap::Pointable::ZONE_HOVERING:
75 return VuoLeapTouchZone_Hovering;
77 case Leap::Pointable::ZONE_NONE:
78 return VuoLeapTouchZone_None;
113 this->receivedFrame = receivedFrame;
119 virtual void onInit(
const Leap::Controller&) {}
120 virtual void onDisconnect(
const Leap::Controller&) {}
121 virtual void onExit(
const Leap::Controller&) {}
122 virtual void onFocusGained(
const Leap::Controller&) {}
123 virtual void onFocusLost(
const Leap::Controller&) {}
125 virtual void onConnect(
const Leap::Controller &controller)
127 controller.enableGesture(Leap::Gesture::TYPE_CIRCLE);
128 controller.enableGesture(Leap::Gesture::TYPE_KEY_TAP);
129 controller.enableGesture(Leap::Gesture::TYPE_SCREEN_TAP);
130 controller.enableGesture(Leap::Gesture::TYPE_SWIPE);
132 controller.setPolicyFlags(Leap::Controller::POLICY_BACKGROUND_FRAMES);
135 virtual void onFrame(
const Leap::Controller &controller)
137 const Leap::Frame frame = controller.frame();
141 Leap::InteractionBox interactionBox = frame.interactionBox();
149 Leap::HandList allHands = frame.hands();
150 Leap::PointableList allPointables = frame.pointables();
152 for (Leap::PointableList::const_iterator pointable = allPointables.begin(); pointable != allPointables.end(); ++pointable)
156 VuoPoint3d tipPosition =
VuoPoint3d_make(stabilized.x, stabilized.y, position.z);
160 (*pointable).isFinger() ? VuoLeapPointableType_Finger : VuoLeapPointableType_Tool,
166 (*pointable).timeVisible(),
167 (*pointable).touchDistance(),
169 (*pointable).isExtended()
175 for(Leap::HandList::const_iterator hand = allHands.begin(); hand != allHands.end(); ++hand)
178 Leap::FingerList fingers = (*hand).fingers();
180 for (Leap::FingerList::const_iterator pointable = fingers.begin(); pointable != fingers.end(); ++pointable)
184 VuoPoint3d tipPosition =
VuoPoint3d_make(stabilized.x, stabilized.y, position.z);
188 VuoLeapPointableType_Finger,
194 (*pointable).timeVisible(),
195 (*pointable).touchDistance(),
197 (*pointable).isExtended()
201 Leap::Matrix basis = (*hand).basis();
202 if ((*hand).isLeft())
209 Leap::Matrix basisInverse = basis.rigidInverse();
210 VuoPoint3d basisPoint3d[3] = {
218 VuoPoint3d palmPosition =
VuoPoint3d_make(stabilized.x, stabilized.y, position.z);
229 (*hand).pinchStrength(),
230 (*hand).grabStrength(),
231 (*hand).timeVisible(),
233 (*hand).confidence(),
244 typedef struct _VuoLeapInternal
246 Leap::Controller *controller;
264 leap->controller =
new Leap::Controller;
266 leap->controller->addListener(*leap->listener);
278 leap->controller->removeListener(*leap->listener);
280 delete leap->listener;
281 delete leap->controller;