<commit_before>import com.neurogami.leaphacking.*;


LeapMotionP5 leap;


void setup() {
  size(displayWidth-30, displayHeight-30, OPENGL);

  noLoop();

  leap = new LeapMotionP5(this, true);
  leap.allowBackgroundProcessing(true);

}

void draw() {
  background(255);
  writePosition();
}

void onFrame(com.leapmotion.leap.Controller controller) {
  processData(controller);
}

void processData(com.leapmotion.leap.Controller controller) {

  Frame frame = controller.frame();
  HandList hands = frame.hands();

  if (hands != null) {
    if (hands.count() > 0 ) {

      d("\tDraw: Have hands.count() = " + hands.count() );
      d("****************** Hand ****************************");
      Hand hand = hands.get(0);

      FingerList fingers = hand.fingers();
      if (fingers.count() >= 1) {
        d(" ******** Fingers " + fingers.count() + " ****** ");

        avgPos = Vector.zero();

        for (Finger finger : fingers) {
          avgPos = avgPos.plus(finger.tipPosition());
        }

        avgPos = avgPos.divide(fingers.count());
        d("avgPos x: " + avgPos.getX() );
        redraw();
      } 
    } 
  }
}

Vector lastPos() {
  Vector lp = new Vector(avgPos);

  if (lp.getX() < xMin ){ xMin = lp.getX(); }
  if (lp.getY() < yMin ){ yMin = lp.getY(); }

  if (lp.getX() > xMax ){  xMax = lp.getX(); }
  if (lp.getY() > yMax ){  yMax = lp.getY(); }

  d(lp.toString());

  return lp;
}


<commit_msg>pointer demo 4 loks OK<commit_after>import com.neurogami.leaphacking.*;
import com.leapmotion.leap.*;

LeapMotionP5 leap;


void setup() {
  size(displayWidth-30, displayHeight-30, OPENGL);

  noLoop();

  leap = new LeapMotionP5(this, true);
  leap.allowBackgroundProcessing(true);

}

void draw() {
  background(255);
  writePosition();
}

void onFrame(com.leapmotion.leap.Controller controller) {
  processData(controller);
}

void processData(com.leapmotion.leap.Controller controller) {

  Frame frame = controller.frame();

  HandList hands = frame.hands();

  if (hands != null) {
    if (hands.count() > 0 ) {

      d("\tDraw: Have hands.count() = " + hands.count() );
      d("****************** Hand ****************************");
      Hand hand = hands.get(0);

      FingerList fingers = hand.fingers();
      if (fingers.count() >= 1) {
        d(" ******** Fingers " + fingers.count() + " ****** ");

        avgPos = Vector.zero();

        for (Finger finger : fingers) {
          avgPos = avgPos.plus(finger.tipPosition());
        }

        avgPos = avgPos.divide(fingers.count());
        normalizedAvgPos = frame.interactionBox().normalizePoint(avgPos );
        d("avgPos x: " + avgPos.getX() );
        redraw();
      } 
    } 
  }
}

Vector lastPos() {
  Vector lp = new Vector(avgPos);
  Vector normlp = new Vector(normalizedAvgPos);

  if (lp.getX() < xMin ){ xMin = lp.getX(); }
  if (lp.getY() < yMin ){ yMin = lp.getY(); }

  if (lp.getX() > xMax ){  xMax = lp.getX(); }
  if (lp.getY() > yMax ){  yMax = lp.getY(); }

  d(normlp.toString());

  return normlp;
}



{'fraction_non_alphanumeric': 0.20376486129458388, 'fraction_numerical': 0.008256274768824307, 'mean_word_length': 2.898326898326898, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6336884', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1043, 'n_words': 210}