sbisker – project 0

by sbisker @ 8:20 pm 12 January 2010

Part A – Noll Knockoff

GDE Error: Unable to load profile settings
import processing.pdf.*;
//Project 0 
//Solomon Bisker
//Some code adapted from Sine Wave example at
//by Daniel Shiffman (since a the fastest way to learn an API is to study
//someone else's code)
int xspacing = 1;   // Initial spacing difference (base value for dx)
int w;              // Width of entire wave
int yoffset = 5; //Spacing between horizontal waves, in pixels
float theta = 0.0;  // Start angle at 0
float amplitude = 75.0;  // Height of wave
float baseperiod = 100.0;  // How many pixels in a full cycle for first period
float dx;  // Intermediate value for incrementing X (recalculated each time)
float[] yvalues;  // Using an array to store height values for the wave
void setup() {
  beginRecord(PDF, "nollknockoff.pdf");
  w = width;
  //Calculate initial dx (with period of 1)
  dx = (TWO_PI / baseperiod) * xspacing ;
  yvalues = new float[800];
void draw() {
  //Let's just calculate the wave once and draw it 90 times.
  //Seems faster.
  //First, calculate and store the wave values
  //Now, we draw the wave 90 times.
  //i simply tells us which wave it is (triggering appropriate
  //horizontal offset in its rendering)
  for (int i=0; i < 90; i++){
  //Stop writing to PDF; finish saving PDF.
void calcWave() {
  // For every x value, calculate a y value with sine function
  float x = theta;
  //We create the "increasing period" by calcuating the regular value of
  //a normal sine function, but just offsetting x each time a linear amount
  //and using interpolation between each point (curveVertex).
    for (int j = 0; j < yvalues.length; j++) 
    //Store that calcuated value
    yvalues[j] = sin(x)*amplitude;
    dx = (TWO_PI / baseperiod) * xspacing / (float) (1+(float) j/100) ;
void renderWave(int i) {
  // A simple way to draw the wave with an ellipse at each location
  //We draw the waves from page top, downward as i increases
  //For each x,y  pair in the function, draw a point, with y value
  //offset by i times some y offset constant...
  for (int x = 0; x < yvalues.length; x++) {

Part B – Pong

It doesn’t seem to like this whole embed thing, so here’s the link to the index page:

Pong (In Stunning Terminal Green)

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