Final Project Alex Walker
Finger Painting: The Painter’s Technological Aid
For this final project, I wanted to create something that I could potentially use in my painting practice. The first day we talked about sensors, I was fascinated by the idea of being able to control color with the movements of one’s body. Its original intent was to be a library for color that the painter had at his or her disposal in cause they could not think of the right color to use. It then progressed into a light source that cause the pigmentation in the painting to change color as you control the color with your hand. This hopefully would create interesting compositions while the artist is painting because the shapes and colors being shown would be changing constantly. I used the LeapMotion hand tracking sensor as my primary tool. Using the code that translated the information from the sensor to processing, I used the coordinates of the palm to be connected to the elves of red, green, and blue. Red is controlled by the movement on the x axis, Green by the movement ion the y axis, and Blue by the movement on the z axis.
import de.voidplus.leapmotion.*;
boolean sketchFullScreen() {
return true;}
LeapMotion leap;
void setup(){
size(displayWidth, displayHeight, OPENGL);
background(255);
// ...
leap = new LeapMotion(this);
}
void draw(){
background (255);
// ...
int fps = leap.getFrameRate();
// ========= HANDS =========
for(Hand hand : leap.getHands()){
// ----- BASICS -----
int hand_id = hand.getId();
PVector hand_position = hand.getPosition();
PVector hand_stabilized = hand.getStabilizedPosition();
PVector hand_direction = hand.getDirection();
PVector hand_dynamics = hand.getDynamics();
float hand_roll = hand.getRoll();
float hand_pitch = hand.getPitch();
float hand_yaw = hand.getYaw();
boolean hand_is_left = hand.isLeft();
boolean hand_is_right = hand.isRight();
float hand_grab = hand.getGrabStrength();
float hand_pinch = hand.getPinchStrength();
float hand_time = hand.getTimeVisible();
PVector sphere_position = hand.getSpherePosition();
float sphere_radius = hand.getSphereRadius();
// ----- SPECIFIC FINGER -----
Finger finger_thumb = hand.getThumb();
// or hand.getFinger("thumb");
// or hand.getFinger(0);
Finger finger_index = hand.getIndexFinger();
// or hand.getFinger("index");
// or hand.getFinger(1);
Finger finger_middle = hand.getMiddleFinger();
// or hand.getFinger("middle");
// or hand.getFinger(2);
Finger finger_ring = hand.getRingFinger();
// or hand.getFinger("ring");
// or hand.getFinger(3);
Finger finger_pink = hand.getPinkyFinger();
// or hand.getFinger("pinky");
// or hand.getFinger(4);
// ----- DRAWING -----
hand.draw();
// hand.drawSphere();
// println(hand.getPosition());
float myhandx = hand.getPosition().x;
float myhandy = hand.getPosition().y;
float myhandz = hand.getPosition().z;
//println ("myhandx = " + myhandx);
//println ("myhandy="+myhandy);
println ("myhandz="+myhandz);
float myred = map(myhandx, 0,displayWidth, 0,255);
float mygreen= map(myhandy, 0,displayHeight, 0,255);
float myblue= map(myhandz, 110,-25, 0,255);
background (myred, mygreen, myblue);
//fill (myred, mygreen,myblue);
//rect(0,0, displayWidth, displayHeight);
//textSize(displayHeight/2);
//text("color", 100, displayHeight/2);
//fill(mygreen,myblue,myred);
// ========= ARM =========
if(hand.hasArm()){
Arm arm = hand.getArm();
float arm_width = arm.getWidth();
PVector arm_wrist_pos = arm.getWristPosition();
PVector arm_elbow_pos = arm.getElbowPosition();
}
// ========= FINGERS =========
for(Finger finger : hand.getFingers()){
// ----- BASICS -----
int finger_id = finger.getId();
PVector finger_position = finger.getPosition();
PVector finger_stabilized = finger.getStabilizedPosition();
PVector finger_velocity = finger.getVelocity();
PVector finger_direction = finger.getDirection();
float finger_time = finger.getTimeVisible();
// ----- SPECIFIC FINGER -----
switch(finger.getType()){
case 0:
// System.out.println("thumb");
break;
case 1:
// System.out.println("index");
break;
case 2:
// System.out.println("middle");
break;
case 3:
// System.out.println("ring");
break;
case 4:
// System.out.println("pinky");
break;
}
// ----- SPECIFIC BONE -----
Bone bone_distal = finger.getDistalBone();
// or finger.get("distal");
// or finger.getBone(0);
Bone bone_intermediate = finger.getIntermediateBone();
// or finger.get("intermediate");
// or finger.getBone(1);
Bone bone_proximal = finger.getProximalBone();
// or finger.get("proximal");
// or finger.getBone(2);
Bone bone_metacarpal = finger.getMetacarpalBone();
// or finger.get("metacarpal");
// or finger.getBone(3);
// ----- DRAWING -----
// finger.draw(); // = drawLines()+drawJoints()
// finger.drawLines();
// finger.drawJoints();
// ----- TOUCH EMULATION -----
int touch_zone = finger.getTouchZone();
float touch_distance = finger.getTouchDistance();
switch(touch_zone){
case -1: // None
break;
case 0: // Hovering
// println("Hovering (#"+finger_id+"): "+touch_distance);
break;
case 1: // Touching
// println("Touching (#"+finger_id+")");
break;
}
}
// ========= TOOLS =========
for(Tool tool : hand.getTools()){
// ----- BASICS -----
int tool_id = tool.getId();
PVector tool_position = tool.getPosition();
PVector tool_stabilized = tool.getStabilizedPosition();
PVector tool_velocity = tool.getVelocity();
PVector tool_direction = tool.getDirection();
float tool_time = tool.getTimeVisible();
// ----- DRAWING -----
// tool.draw();
// ----- TOUCH EMULATION -----
int touch_zone = tool.getTouchZone();
float touch_distance = tool.getTouchDistance();
switch(touch_zone){
case -1: // None
break;
case 0: // Hovering
// println("Hovering (#"+tool_id+"): "+touch_distance);
break;
case 1: // Touching
// println("Touching (#"+tool_id+")");
break;
}
}
}
// ========= DEVICES =========
for(Device device : leap.getDevices()){
float device_horizontal_view_angle = device.getHorizontalViewAngle();
float device_verical_view_angle = device.getVerticalViewAngle();
float device_range = device.getRange();
}
}
// ========= 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");
}