Assignment: Personal Kinetic Sculpture

My personal kinetic sculpture: Metamirror             This rough sketch encapsulates the idea that is my kinetic sculpture. I named is metamirror as it is in a sense a metallic mirror. This sculpture can my place in any place with direct sunlight like an outdoor area or underneath a sunroof.  Each […]

Kinetic Interfaces- Midterm Project (Moon)

Name: Mehr Un Nisa Javed Professor: Moon Date: 2nd November’2018 Objective: Use one of the interaction learnt in the class to develop it further into a midterm project. Title: “High School Musical” Here is my initial idea which I had when I made the Concept Presentation: https://docs.google.com/presentation/d/1nPUh8OmwZWrOb3E8xBXx4bFP6jtO6aheJUJ3CuZLU3o/edit?usp=sharing Inspiration for the Project: In my childhood I used to watch […]

Kinetic Interfaces – week 6: Leap Motion (Emerald)

For this assignment we are going to use the leap motion and to create some interaction between screen and hand movement. I’m really interested in the gesture, so I tried the grab gesture this time. Basically I build a simple interaction, that user can move his hand and grab the small ball, which are randomly generated, […]

float handX, handY;
float HG;


ArrayList<Ball> balls = new ArrayList<Ball>();

void setup() {
  size(600, 600);
  background(255);

  leapMotion_setup();

  for (int i=0; i<2; i++) {
    balls.add(new Ball(random(100, width-100), random(100, height-100), color(random(255), random(255), random(255))));
  }
}

void draw() {
  background(255);
  leapMotion_draw();


  for (int i=0; i<balls.size(); i++) {
    Ball b = balls.get(i);
    b.display();
  }

  float dis1 = dist(balls.get(0).x, balls.get(0).y, handX, handY);
  float dis2 = dist(balls.get(1).x, balls.get(1).y, handX, handY);
  
  if (dis1 < 50 && HG > 0.6){
    balls.get(0).x = handX;
    balls.get(0).y = handY;
  }
  
  if (dis2 < 50 && HG > 0.6){
    balls.get(1).x = handX+10;
    balls.get(1).y = handY+10;
  }
  
 
}


class Ball {
  float x, y;
  color c;

  Ball(float _x, float _y, color _c) {
    x = _x;
    y = _y;
    c = _c;
  }

  void display() {
    noStroke();
    fill(c);
    ellipse(x, y, 40, 40);
  }
}

import de.voidplus.leapmotion.*;

LeapMotion leap;

void leapMotion_setup() {

  leap = new LeapMotion(this);
  
}


// ======================================================
// 1. Callbacks

void leapOnInit() {
  // println("Leap Motion Init");
}
void leapOnConnect() {
  // println("Leap Motion Connect");
}
void leapOnFrame() {
  // println("Leap Motion Frame");
}
void leapOnDisconnect() {
  // println("Leap Motion Disconnect");
}
void leapOnExit() {
  // println("Leap Motion Exit");
}


void leapMotion_draw() {

  int fps = leap.getFrameRate();
  for (Hand hand : leap.getHands ()) {


    // ==================================================
    // 2. Hand

    int     handId             = hand.getId();
    PVector handPosition       = hand.getPosition();
    PVector handStabilized     = hand.getStabilizedPosition();
    PVector handDirection      = hand.getDirection();
    PVector handDynamics       = hand.getDynamics();
    float   handRoll           = hand.getRoll();
    float   handPitch          = hand.getPitch();
    float   handYaw            = hand.getYaw();
    boolean handIsLeft         = hand.isLeft();
    boolean handIsRight        = hand.isRight();
    float   handGrab           = hand.getGrabStrength();
    float   handPinch          = hand.getPinchStrength();
    float   handTime           = hand.getTimeVisible();
    PVector spherePosition     = hand.getSpherePosition();
    float   sphereRadius       = hand.getSphereRadius();

    // --------------------------------------------------
    // Drawing
    //hand.draw();
    
    handX = hand.getPosition().x;
    handY = hand.getPosition().y;
    
    HG = handGrab;
    //println(HG);

    // ==================================================
    // 3. Arm

    if (hand.hasArm()) {
      Arm     arm              = hand.getArm();
      float   armWidth         = arm.getWidth();
      PVector armWristPos      = arm.getWristPosition();
      PVector armElbowPos      = arm.getElbowPosition();
    }


    // ==================================================
    // 4. Finger

    Finger  fingerThumb        = hand.getThumb();
    // or                        hand.getFinger("thumb");
    // or                        hand.getFinger(0);

    Finger  fingerIndex        = hand.getIndexFinger();
    // or                        hand.getFinger("index");
    // or                        hand.getFinger(1);

    Finger  fingerMiddle       = hand.getMiddleFinger();
    // or                        hand.getFinger("middle");
    // or                        hand.getFinger(2);

    Finger  fingerRing         = hand.getRingFinger();
    // or                        hand.getFinger("ring");
    // or                        hand.getFinger(3);

    Finger  fingerPink         = hand.getPinkyFinger();
    // or                        hand.getFinger("pinky");
    // or                        hand.getFinger(4);
    
    
    


    for (Finger finger : hand.getFingers()) {
      // or              hand.getOutstretchedFingers();
      // or              hand.getOutstretchedFingersByAngle();

      int     fingerId         = finger.getId();
      PVector fingerPosition   = finger.getPosition();
      PVector fingerStabilized = finger.getStabilizedPosition();
      PVector fingerVelocity   = finger.getVelocity();
      PVector fingerDirection  = finger.getDirection();
      float   fingerTime       = finger.getTimeVisible();

      // ------------------------------------------------
      // Drawing

      // Drawing:
      // finger.draw();  // Executes drawBones() and drawJoints()
      strokeWeight(14);
      finger.drawBones();
      //finger.drawJoints();

      // ------------------------------------------------
      // Selection

      


      // ================================================
      // 5. Bones
      // --------
      // https://developer.leapmotion.com/documentation/java/devguide/Leap_Overview.html#Layer_1

      Bone    boneDistal       = finger.getDistalBone();
      // or                      finger.get("distal");
      // or                      finger.getBone(0);

      Bone    boneIntermediate = finger.getIntermediateBone();
      // or                      finger.get("intermediate");
      // or                      finger.getBone(1);

      Bone    boneProximal     = finger.getProximalBone();
      // or                      finger.get("proximal");
      // or                      finger.getBone(2);

      Bone    boneMetacarpal   = finger.getMetacarpalBone();
      // or                      finger.get("metacarpal");
      // or                      finger.getBone(3);

      // ------------------------------------------------
      // Touch emulation

      int     touchZone        = finger.getTouchZone();
      float   touchDistance    = finger.getTouchDistance();

      switch(touchZone) {
      case -1: // None
        break;
      case 0: // Hovering
        // println("Hovering (#" + fingerId + "): " + touchDistance);
        break;
      case 1: // Touching
        // println("Touching (#" + fingerId + ")");
        break;
      }
    }


    // ==================================================
    // 6. Tools

    for (Tool tool : hand.getTools()) {
      int     toolId           = tool.getId();
      PVector toolPosition     = tool.getPosition();
      PVector toolStabilized   = tool.getStabilizedPosition();
      PVector toolVelocity     = tool.getVelocity();
      PVector toolDirection    = tool.getDirection();
      float   toolTime         = tool.getTimeVisible();

      // ------------------------------------------------
      // Drawing:
       tool.draw();

      // ------------------------------------------------
      // Touch emulation

      int     touchZone        = tool.getTouchZone();
      float   touchDistance    = tool.getTouchDistance();

      switch(touchZone) {
      case -1: // None
        break;
      case 0: // Hovering
        // println("Hovering (#" + toolId + "): " + touchDistance);
        break;
      case 1: // Touching
        // println("Touching (#" + toolId + ")");
        break;
      }
    }
  }


  // ====================================================
  // 7. Devices

  for (Device device : leap.getDevices()) {
    float deviceHorizontalViewAngle = device.getHorizontalViewAngle();
    float deviceVericalViewAngle = device.getVerticalViewAngle();
    float deviceRange = device.getRange();
  }
}

Kinetic Interfaces: Assignment Week4+5 (Emma)

Here is the link to my week4 assignment: Click Here For the assignment this week, we are asked to program an interactive or alternated portraiture with Pixel Iteration or Manipulation. I think the process of calculating and expressing is very interesting. I created two experience for this assignment, one is very basic, and the second one is […]

PImage img;

void setup() {
  size(800, 800);
  background(0);
  noStroke();
  
 img = loadImage("NewYorkUniversity.jpg");
   
 
}

void draw() {
   image(img,0,0,800,800);
   int ct = 255;
    textSize(50);
    fill(255);
   text("Press The Mouse!", 200,80);
}

void mousePressed() {
  println("1");
  int w = img.width;
  int h = img.height;

  img.loadPixels();
  for (int y =0; y<h; y++) {
    for (int x=0; x<w; x++) {
      int index = x+y*w;
      color c = img.pixels[index];
      float r = red(c);
      //float g = green(c);
      //float b = blue (c);


      if (r >200) {
        img.pixels[index]=color(87.0, 5.0, 139.0);
      } 
      else {
        img.pixels[index]=color(255);
        
      }
    }
   
  }
  img.updatePixels();
  image(img, 0, 0, 800, 800);
}








2. 
PImage img;

void setup() {
  size(800, 800);
  background(0);
  noStroke();

  img = loadImage("NewYorkUniversity.jpg");
}

void draw() {
  image(img, 0, 0, 800, 800);

  //for (int x = 0; x<img.width; x+=40) {
  //  stroke(255);
  //  strokeWeight(1);
  //  line(x, 0, x, img.height);
  //}

  //for (int y=0; y<img.height; y+=40) {
  //  stroke(255);
  //  strokeWeight(1);
  //  line(0, y, img.width, y );
  //}
}

void mousePressed() {
  img = loadImage("NewYorkUniversity.jpg");

  int w = img.width;
  int h = img.height;

  img.loadPixels();

  int index = (mouseY-1)*w + mouseX;
  println(index);
  println(mouseX, mouseY);

  color c = img.get(mouseX, mouseY);


  for (int b=0; b<21; b++) {
    for (int a=0; a<21; a++) {
      if (red(c)<100) {
        img.pixels[index+w*b+a]=color(255);
      } else if (red(c)>200) {
        img.pixels[index+w*b+a]=color(87, 5, 139);
      }
    }
  }
  img.updatePixels();
  image(img, 0, 0, 800, 800);
}