Plotting spirals... (I started to plot the a lot of random spirals and because it was taking soooooo long.. I changed the return # to be less... so the top right collection of spirals are plotted and the rest are duplicated layers of the original.)..

oh by the way... PLOTTING SUCKS!!!!

 
 
 
 
// Using polar coords
// drawing a spiral


// set dimensions for new document
var w = 500; // units
var h = 500;

// instantiate raster canvas for use
var RC = new RasterCanvas(w, h, Units.PIXELS)

//set background color
RC.setBackgroundColor(.7,.7,.7);

//create function so I can resuse spiral!

function spiral(revolutions, x, y){

// initialize variables
var opacity = 1;

// define limit x and y to help stay on canvas
var limX = w-1;
var limY = h-1;

// define centerpoint of circle
var centerX = (limX / 2)*Math.random();
var centerY = (limY / 2)*Math.random();

// define resolution of plot (angular distance between samples)
var plotRes = .02;

// spiral params
var totalRadians = 2 * Math.PI * revolutions;
var growthInc = .05; // affects how rapidly spiral gets bigger

// plot a circle using polar coordinates
for (var radianAngle=0, distance=0; radianAngle < totalRadians; radianAngle+=plotRes, distance+=growthInc) {
var cartesianPoint = polarToCartesian(distance, radianAngle);
RC.setPixel(centerX+cartesianPoint[0],centerY+cartesianPoint[1], opacity);

}

}


// iterate to span across rows and columns
for (var x = 0; x < 3; x++) {
for (var y = 0; y <3 ; y++) {
//
RC.setPenColor(Math.random()*.6, 0, Math.random()*.6);

//call function spiral
spiral(Math.random()*5, x, y);
}
}

// release object referencess
RC = null;