Heather Knight – 13-9-65
In this program, I attempt to recreate the experience of witnessing Frieder Nake’s “13/9/65 Nr. 2” come to life. My functions create X-Y paths for the plotter pixel by pixel, and are mutually inspired the line-thicknesses and supporting-structures of a 3D-printer (hence the initial outline, and the white dot left each time the ‘nozzle’ is lifted). I wanted to create a modern-day instantiation and took poetic license with the simplifications of resulting forms. The most challenging part was deriving how to draw a circle without using a pre-built function, for which I borrowed an early computer graphics technique called the Midpoint Circle Algorithm.
[vimeo=https://vimeo.com/35554900]
Above you find a demo video of the program. My browser couldn’t handle my .jar but the file is here. Please find my code below. To run the program with full effect, download the printer soundclip here.
//Heather Knight - HW2.2 - "13-9-65" Plotter
import ddf.minim.*;
// states
boolean draw_outline=true;
boolean draw_lines=false;
boolean next_vertical = false;
boolean next_horizontal = false;
boolean carriage_return = false;
boolean next_circle=false;
boolean next_blip = false;
boolean done = false;
// screen variables
int x=0;
int y=0;
int w=640;
int h=480;
int liw=8; //linewidth
// function variables
int i=0;
int hjump=0;
int minjump=15;
int blipval = 0;
int circleval = 0;
int savey=0;
int savex=0;
boolean error=false;
boolean first = true;
// circle variables
int[] xarray = new int[1];
int[] yarray = new int[1];
int numpix=0; //number pixels per octant
int radius;
int rad_sq;
int j=0;
int center_x;
int center_y;
//sound
Minim minim;
AudioPlayer player;
void setup() {
// set draw characteristics
fill(255);
// setup window
size(w+liw, h+liw);
//setup sound
minim = new Minim(this);
player = minim.loadFile("printer.wav");
player.loop();
println("Setup Complete");
}
void draw() {
i += 1;
//println(i);
if (draw_outline) {
if (!first&&(x==0)&&(y==0)) {
draw_outline=false;
draw_lines=true;
next_vertical=true;
}
else if ((x<w)&&(y==0)) {
x = x + 1;
first = false;
//println("top");
}
else if ((x==w)&&(y0)) {
x = x - 1;
//println("bottom");
}
else if ((x==0)&&(y>0)) {
//println("leftside");
y = y - 1;
}
else{
error=true;
println("error");
}
}
else if (draw_lines) {
if(next_vertical){
if(y==h){
player.close();
println("done");
next_vertical=false;
done = true;
}
else{
hjump=int(random(h)/3);
if(hjumph){
println("jump down!");;
hjump = h-y;
y=h;
}else{
y=y+hjump;
}
next_vertical=false;
next_horizontal=true;
}
}
else if(next_horizontal){
blipval = int(random(100));
if (x==w){
next_horizontal=false;
carriage_return=true;
}
else if (blipval < 2){
//randomly decide on brips travel up
println("blip!");
savey=y;
next_blip = true;
next_horizontal = false;
}
else{
//travel horizontally
x+=1;
}
}
else if(next_blip){
if(y==(savey-hjump)){
y=savey;
next_blip=false;
next_horizontal=true;
}
else{
y=y-1;
}
}
else if(carriage_return){
circleval = int(random(1000));
if (x==0){
carriage_return=false;
next_vertical=true;
}
else if (circleval < 2){
//randomly decide on brips travel up
println("circle!");
//circle inits
center_y=x;
center_x=y-hjump/2;
radius=hjump/2;
if(((center_x+radius/2)=0)&((center_y+radius/2)=0)){
savey=y;
savex=x;
next_circle = true;
calc_circle(radius);
carriage_return = false;
}
}
else{
//travel horizontally back to zero
x-=1;
}
}
else if(next_circle){
j+=1;
if(j<numpix){
println("j="+j+" yval="+yarray[j]+" xval="+xarray[j]);
ellipse(yarray[j]+center_y,xarray[j]+center_x,liw,liw);
if(j==numpix-1){
println("octant1 done");
}
}
else if(j<numpix*2){
ellipse(xarray[numpix-(j-numpix)-1]+center_y,yarray[numpix-(j-numpix)-1]+center_x,liw,liw);
if(j==numpix*2-1){
println("octant2 done");
}
}
else if(j<numpix*3){
ellipse(xarray[j-numpix*2]+center_y,-yarray[j-numpix*2]+center_x,liw,liw);
if(j==numpix*3-1){
println("octant3 done");
}
}
else if(j<numpix*4){
ellipse(yarray[numpix-(j-numpix*3)-1]+center_y,-xarray[numpix-(j-numpix*3)-1]+center_x,liw,liw);
if(j==numpix*4-1){
println("octant4 done");
}
}
else if(j<numpix*5){
ellipse(-yarray[j-numpix*4]+center_y,-xarray[j-numpix*4]+center_x,liw,liw);
if(j==numpix*5-1){
println("octant5 done");
}
}
else if(j<numpix*6){
ellipse(-xarray[numpix-(j-numpix*5)-1]+center_y,-yarray[numpix-(j-numpix*5)-1]+center_x,liw,liw);
if(j==numpix*6-1){
println("octant6 done");
}
}
else if(j<numpix*7){
ellipse(-xarray[j-numpix*6]+center_y,yarray[j-numpix*6]+center_x,liw,liw);
if(j==numpix*7-1){
println("octant7 done");
}
}
else if(j=radius/2){
yy=yy+1;
xx=int(sqrt(rad_sq-yy*yy));
xarray=append(xarray, xx);
yarray=append(yarray, yy);
}
println("xarray.length "+xarray.length);
numpix=xarray.length;
j=0;
}
void stop()
{
//player.close();
minim.stop();
super.stop();
}