Amanda Burridge — Project 0a

by aburridg @ 7:37 am 13 January 2010

This was fun! I used Processing to generate the sinusoidal lines and then cropped and scaled in Adobe Illustrator. Here’s my final rendition

And, here’s my code. I haven’t taken calculus for a few years now, so I based a lot of the sin math off of the trigg tutorial on the Processing website, located here.

float radius = 50;
float period;
 
// separating each curve vertically by 5px
int lineSpacing = 5;
 
void setup() {
  size(800, 500);
  background(255);
  noFill();
}
 
void draw() {
  background(255);
 
  // need to draw 90 parallel lines
  for (int j = 0; j < (89*lineSpacing+1); j += lineSpacing){
    curve(j);
  }
}
 
void curve(int ly){
    period = 1;
    stroke(0);
    beginShape();
    for(int i=0; i<width; i++) {
        vertex(i, singraph((float)i/50)*radius + ly);
 
        period = period - 0.0009;
    }
    endShape();
}
 
float singraph(float sa) {
  //scale from -1 to 1
  sa = (sa - 0.5) * 1.0; 
  sa = sin(sa*2*PI*period)/2 + 0.5;
 
  return sa;
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2016 Special Topics in Interactive Art & Computational Design | powered by WordPress with Barecity