ikrsek-SectionC-Project-07-Curves

http://mathworld.wolfram.com/SphericalSpiral.html

sketch

//Isadora Krsek
//Ikrsek@andrew.cmu.edu
//Section C
//Project 07: Curves

var x; 
var y; 
var z; 

function setup() {
    createCanvas(400, 400);
    noStroke();
}
 
function draw() {
    background(0);
    //adjusting placement & size of curves
    translate(width/2, height/2);
    scale(150)
    limit = (map(mouseX, 0, width, 2, 8)); //caps the # of loops
    limit2 = (map(mouseY,0,height,20, 80)) //caps the # of loops
    push();
    scale(3,3)
    rotate(radians(90));
    push();
    rotate(mouseY,0,height,0,360)
    drawLoxoB();
    pop();
    drawLoxo();
    pop();
}


function drawLoxo() {
  //a controls how many strokes there are in terms of representing the loxodrome
    for (var a=.4; a<limit; a+=.2) {  
    //color change mapped to a
      var rValue = (map(a, 0.4, 4, 0, 360))
      fill(rValue);
      beginShape(QUADS);   
      for (var t = -20; t <limit2; t+=.1) {
        x = ((cos(t))/(sqrt(1+pow(a,2)*pow(t,2))));
        y = ((sin(t))/(sqrt(1+pow(a,2)*pow(t,2))));
        vertex(x, y);
      }
      endShape();
    } 
}

function drawLoxoB() {
  for (var a=.4; a<limit; a+=.2) { 
    var rValue = (map(a, 4, 0.4, 0, 360)) 
    fill(rValue);
    beginShape(QUAD_STRIP);   
    for (var t = -20; t <limit2; t+=.1) {
      x = ((cos(t))/(sqrt(1+pow(a,2)*pow(t,2))));
      y = ((sin(t))/(sqrt(1+pow(a,2)*pow(t,2))));
      vertex(x, y);
    }
    endShape();
  } 
}

I was looking at a few different curves but was most inspired by the loxodrome which I decided to try to replicate 2-dimensionally.

I wanted to create something a little haunting, but still somewhat visually exciting in the spirit of October, and as a result this is what I came up with. It brings to mind for me, the headlight of a train as it’s running towards you inside of a tunnel.

 

 

Leave a Reply