EDIT:
i opened up another thread about the following:
hey people,
i was developing a library in the recent days aswell:
since i am developing on windows, those two wrappers you're talking about were not really an option for me. i fixed the bug with the application crashing when using heuermh's (and prolly your library aswell, darius) by not using reflection in the library and its working neatly. moreover i am trying to structure the access of the leap data from processing a little different- i wanna processingify it a little. for the cases i am planning on using the leap i need a little more high level access to data and gestures- this is what i am working on in my library. and i think that unneccessary callbacks are not really important and i dont like them in processing. just a personal oppinion though!
you can download the library on my github account- but take care, the library is going to undergo a few changes in the process of developing it. i wanna point out again that i am not only writing a wrapper, but implementing a library to make some meaningfull use of the leap- for example for using it as an actual user interface for your application. i agree to bit.craft about that multiple libraries are not really neccessary and i am already in contact with heuermh to fix some issues. he's trying to fix the bug and is already in contact with ben fry and the leap motion creators. apparently the sdk is not supported on windows xp yet, but i have the same problem with win7- so i dont know when this is going to be fixed.
since i am not writing my library in the same way the leap sdk works im going to point out the biggest difference in the architecture here. in order to access the most current frame and draw the actual points of the leap use it this way:
- LeapMotionP5 leap;
- public void setup() {
- size(500, 500);
- leap = new LeapMotionP5(this);
- }
- public void draw() {
- background(0);
- fill(255);
- for (Finger finger : leap.getActiveFingers()) {
- ellipse(leap.leapToScreenX(finger.tipPosition().getX()),
- leap.leapToScreenY(finger.tipPosition().getY()), 10, 10);
- }
- }
- public void stop() {
- leap.stop();
- super.stop();
- }
of course you can access the current frame to use the leap api a little more low level. this enables you the same power over the data as the original leap sdk:
- LeapMotionP5 leap;
- public void setup() {
- size(500, 500);
- leap = new LeapMotionP5(this);
- }
- public void draw() {
- Frame frame = leap.getCurrentFrame();
-
- if (frame.hands().empty() == false) {
- Hand hand = frame.hands().get(0);
- if (hand.fingers().empty() == false) {
- hand.fingers().get(0);
- }
- }
- }
moreover you can access the last 250 frames from the leap, in order to do some gesture recognition on those frames. i am providing gesture support so far, but if you want to write your own gestures, you are welcome to do it and contribute it to the library if you wanna:
- LeapMotionP5 leap;
- public void setup() {
- size(500, 500);
- leap = new LeapMotionP5(this);
- }
- public void draw() {
- for(Frame frame : leap.getFrames()){
- //do something with the last 250 frames
- }
- }
to be precise, i included the following gestures already:
- SwipeLeft
- SwipeRight
- SwipeTop
- SwipeBottom
- Push
- Pull
- VictoryPose
and the onedollar unistroke recognizer gestures
(drawing a circle, rectangle, triangle and so forth. more documentation to come)(cheers darius!)
like i said, the library is in constant development and the api is going to change all the time so far. if you like it and want to contribute dont hesitate to say hi or check it out on github:
https://github.com/mrzl/LeapMotionP5
yours,
marcel