thread drawing

thread drawing

Inspired by a well known viral project of drawing renaissance portraits with thread, we set out to verify it for ourselves [via Processing, Grasshopper, and a robot].

Prototype was successfully completed with an Abe (the ABB robot arm) and Ryan (human) from GRAYSHED.

main file below - ask if you need more

import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.geom.mesh.subdiv.*;
import toxi.geom.mesh2d.*;
import toxi.math.*;
import toxi.math.conversion.*;
import toxi.math.noise.*;
import toxi.math.waves.*;
import toxi.util.*;
import toxi.util.datatypes.*;
import toxi.util.events.*;



 
PImage img;  // Declare a variable of type PImage

boolean showImg = false; 
boolean showSImg = true; 
boolean showLine = false; 
boolean halt = false; 
SmartLine[] SLarr;
int N = 5000;  //how many lines to place in the beginning
SmartPixels SP; 
Perimeter P;

void setup() {
  size(800,800,P3D);
  //img = loadImage("dot.png");
  //img = loadImage("dotR.png");
  //img = loadImage("RadialGradient100.png");
  //img = loadImage("mona100.jpg");
  //img = loadImage("mona100R.jpg");

  img = loadImage("mona100.png");
  //img = loadImage("mona100R.png");
  
  
  //setup Perimeter
  Vec2D A = new Vec2D (0,0);
  Vec2D B = new Vec2D (img.width,0);
  Vec2D C = new Vec2D (img.width,img.height);
  Vec2D D = new Vec2D (0,img.height);
   println("END OF SETUPss");
  P = new Perimeter(new Vec2D[] ); //accepts edge vertices
  SP = new SmartPixels(); 
  SLarr = new SmartLine[N]; 
  SLarr[0] = new SmartLine (  P.nails.get(0).get(0) , 0  ); 
  //println( "searching for 1st Best Path" );
  SLarr[0].searchForBestPath();
  
  println();
  println("END OF SETUP");
 
  //END OF SETUP
}

void draw() {
  
  translate(width/2-img.width/2,height/2-img.height/2,600);
  background(255);
  // Draw the image to the screen at coordinate (0,0)
  if (showImg) image(img,0,0);
  if (showSImg) image(SP.strengthImg, 0,0);
  //P.drawNails();
  
  if ((frameCount) < SLarr.length) {
    SLarr[frameCount] = new SmartLine (  SLarr[frameCount-1].targetNail , SLarr[frameCount-1].targetVecId  ); 
    SLarr[frameCount].searchForBestPath();
    SP.updateStrengthImg(); 
  }
  if (showLine) {for (int i=0; ((i<=frameCount)&&(i<N)); i++)    }
  

 //XW L = new XW (50,50,mouseX, mouseY    );
 //L.drawLine();


  
  println(frameCount + " ***ENDFRAME");
  //delay(500);
  
  
  //while (frameCount > 4)






void keyPressed() {
  //print(key);
  if (key == 'i') {
    showImg = !showImg;
  }
  if (key == 's') {
    showSImg = !showSImg;
  }
    if (key == 'l') {
    showLine = !showLine;
  }
  if (key == 'h') {
    halt = !halt;
  }
  
}
Necklace for a giant

Necklace for a giant

Rurki (Pipes)

Rurki (Pipes)