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;
78 case Leap::Pointable::ZONE_NONE:
79 return VuoLeapTouchZone_None;
114 this->receivedFrame = receivedFrame;
120 virtual void onInit(
const Leap::Controller&) {}
121 virtual void onDisconnect(
const Leap::Controller&) {}
122 virtual void onExit(
const Leap::Controller&) {}
123 virtual void onFocusGained(
const Leap::Controller&) {}
124 virtual void onFocusLost(
const Leap::Controller&) {}
126 virtual void onConnect(
const Leap::Controller &controller)
128 controller.enableGesture(Leap::Gesture::TYPE_CIRCLE);
129 controller.enableGesture(Leap::Gesture::TYPE_KEY_TAP);
130 controller.enableGesture(Leap::Gesture::TYPE_SCREEN_TAP);
131 controller.enableGesture(Leap::Gesture::TYPE_SWIPE);
133 controller.setPolicyFlags(Leap::Controller::POLICY_BACKGROUND_FRAMES);
136 virtual void onFrame(
const Leap::Controller &controller)
138 const Leap::Frame frame = controller.frame();
142 Leap::InteractionBox interactionBox = frame.interactionBox();
150 Leap::HandList allHands = frame.hands();
151 Leap::PointableList allPointables = frame.pointables();
153 for (Leap::PointableList::const_iterator pointable = allPointables.begin(); pointable != allPointables.end(); ++pointable)
157 VuoPoint3d tipPosition =
VuoPoint3d_make(stabilized.x, stabilized.y, position.z);
161 (*pointable).isFinger() ? VuoLeapPointableType_Finger : VuoLeapPointableType_Tool,
167 (*pointable).timeVisible(),
168 (*pointable).touchDistance(),
170 (*pointable).isExtended()
176 for(Leap::HandList::const_iterator hand = allHands.begin(); hand != allHands.end(); ++hand)
179 Leap::FingerList fingers = (*hand).fingers();
181 for (Leap::FingerList::const_iterator pointable = fingers.begin(); pointable != fingers.end(); ++pointable)
185 VuoPoint3d tipPosition =
VuoPoint3d_make(stabilized.x, stabilized.y, position.z);
189 VuoLeapPointableType_Finger,
195 (*pointable).timeVisible(),
196 (*pointable).touchDistance(),
198 (*pointable).isExtended()
202 Leap::Matrix basis = (*hand).basis();
203 if ((*hand).isLeft())
210 Leap::Matrix basisInverse = basis.rigidInverse();
211 VuoPoint3d basisPoint3d[3] = {
219 VuoPoint3d palmPosition =
VuoPoint3d_make(stabilized.x, stabilized.y, position.z);
230 (*hand).pinchStrength(),
231 (*hand).grabStrength(),
232 (*hand).timeVisible(),
234 (*hand).confidence(),
247 Leap::Controller *controller;
265 leap->controller =
new Leap::Controller;
267 leap->controller->addListener(*leap->listener);
279 leap->controller->removeListener(*leap->listener);
281 delete leap->listener;
282 delete leap->controller;