[SOLVED] *NOOB* Fourier Series / Need help, transforming p5j code into processing (Java)

Hi,

I am trying to transscript Daniel Shiffman’s Code for Fourier Series to be processing-readable.

Fourier Series | The coding train

I am beginner and managed to get this far until i got quite a bit lost; line 34 (wave.push(y2) ) gives me an error "
Cannot invoke push(float) on the array type float "

I couldn’t find any information on the internet, thus i am asking you, if anyone could help me out :slight_smile:

float radius;
float time;
float x;
float y;
float x2;
float y2;
float wave[];
int i ;


void setup() {

  size(800, 800);
  radius = 100;
  x = width/2;
  y= height/2;

  x2 = x;
  y2 = y;
}

void draw() {

  time += 0.05; 

  background(0);
  fill(255);
  noStroke();

  stroke(255);
  noFill();
  ellipse(x-200, y, radius *2, radius*2);

  wave.push(y2); 

  pushMatrix();
  translate(x-200, y);

  x2 = radius * cos(time);
  y2 = radius * sin(time);


  fill(255);
  line(0, 0, x2, y2);
  ellipse(x2, y2, 8, 8);

  popMatrix();


  for ( int i = 0; i < wave.length; i++) {
    point(i, wave[i]);
  }
}

2 Likes

You are my hero, thanks <3