We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › not discrete sine wave
Page Index Toggle Pages: 1
not discrete sine wave (Read 485 times)
not discrete sine wave
Apr 26th, 2009, 6:16am
 
hi guys i just want to draw a sine wave.

i've done this:
Code:
int limit=30;
void setup() {
size(800,300);
smooth();
}

void draw() {
background(255);

float x=0,y=0;
float angle = 0, amplitude = 60;
for(x=0;x<width;x++) {
angle+=0.1;
y = amplitude*sin(angle);
stroke(0);
point(x,y + 150);
}
}


but.. too discret, there are a lot of white spaces beetween point.
how make it real continuous wave??
Re: not discrete sine wave
Reply #1 - Apr 26th, 2009, 6:42am
 
Common practice is to use line() between previous point and current one instead. Not perfect, but already an improvement! Wink
Page Index Toggle Pages: 1