Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Basic hand Location

 

Gesture Recognition

 

Finger and Joint Locations

import de.voidplus.leapmotion.*;

LeapMotion leap;

void setup() {
  size(800, 500);
  leap = new LeapMotion(this);
}

void draw() {
  background(255);

  // ========= HANDS =========

  for (Hand hand : leap.getHands ()) {
    // ----- SPECIFIC FINGER POINT -----

    Finger  finger_thumb     = hand.getThumb();
    PVector  finger_thumb_loc  = finger_thumb.getPosition();

    Finger  finger_index     = hand.getIndexFinger();
    PVector finger_index_loc  = finger_index.getPosition();

    Finger  finger_middle    = hand.getMiddleFinger();
    PVector finger_middle_loc  = finger_middle.getPosition();


    Finger  finger_ring      = hand.getRingFinger();
    PVector finger_ring_loc = finger_ring.getPosition();

    Finger  finger_pink      = hand.getPinkyFinger();
    PVector finger_pink_loc  = finger_pink.getPosition();

    // ----- DRAWING -----

    drawEllipse(finger_thumb_loc);
    drawEllipse(finger_index_loc);
    drawEllipse(finger_middle_loc);
    drawEllipse(finger_ring_loc);
    drawEllipse(finger_pink_loc);

  
  // ========= Joints =========

    for (Finger finger : hand.getFingers()) {

      // ----- SPECIFIC BONE -----

      Bone bone_distal = finger.getDistalBone();

      Bone bone_intermediate = finger.getIntermediateBone();

      Bone bone_proximal = finger.getProximalBone();

      Bone bone_metacarpal = finger.getMetacarpalBone();

      // ----- DRAWING -----
      
      finger.drawJoints();
      finger.drawLines();
      
    }
  }
}

void drawEllipse(PVector point) {
  ellipse(point.x, point.y, 10, 10);
}