void setup() { size(1280, 800); background (0); } void draw() { noStroke(); noSmooth(); //USER DEFINED VARIABLES float layerHeight = 0.025; //printer layerthickness in millimeters float area = 0.50; //area as factor of total size, 1280x800 //strand size in n x n pixels from base to tip int basePixelSize = 8; int tipPixelSize = 4; int pixelSize; float hairHeight = 5; //height of hair in millimeters float hairLayers = hairHeight/layerHeight; //total number of hair layers float separationFactor = 2; //hair strands separated by a separation mulitple float separationPixels = separationFactor*basePixelSize; int baseLayerThickness = 1; // thickness of the solid base in millimeters float baseLayers = baseLayerThickness/layerHeight; float perimeter = 2*basePixelSize; //----------------------------------------------------------------------------------------// //starting location float Xstart = width/2 - width*area/2; float Ystart = height/2 - height*area/2; //number of layers for each pixel size float gradiation = hairLayers/(basePixelSize - tipPixelSize + 1); //printable area float printWidth = width*area; float printHeight = height*area; //Number of strands across width and height of printable area float NoStrandsWidth = printWidth/separationPixels; float NoStrandsHeight = printHeight/separationPixels; int counter = 1; //filname counter for (int i = 1; i <=baseLayers; i = i + 1) { rect(Xstart, Ystart, printWidth, printHeight); //define filenmae as NAME_XXXX.png String number = nf(counter, 1); String name = "slice_"; String imageType = ".png"; String filename = name + number + imageType; save(filename); counter = counter + 1; } background(0); for (int s = basePixelSize; s>=tipPixelSize; s=s-1) { pixelSize = s; //draw rectangles at each position over the printable area and write .png to file for (int k=1; k <= gradiation; k=k+1) { for (int j = 1; j