The standard definition of a parabola is any curve of the form:
y = k*x^2 + c
Obviously, you can scale and rotate the coordinate system so that you get parabolas at different orientations. But for your question, of how to know the exact coordinates of the points in the parabola, you just take any value 'x' and compute the value 'y' from the above formula. The parameters 'k' and 'c' control how wide/narrow the parabola is, and how much it is shifted up or down relative to the x-axis.
Quote:void setup()
{
size(400,400);
background(0);
stroke(255);
noLoop();
}
void draw()
{
// set up the coordinate axes:
translate(width/2,height/2);
scale(1, -1);
line(0, 200, 0, -200);
line(-200, 0, 200, 0);
// draw three random parabolas
for(int i = 0; i < 3; i++)
{
float k = random(-.1, .1);
float c = random(-50, 50);
for(float x = -200; x < 200; x++)
{
float y = k*x*x + c;
point(x,y);
}
}
}
void mousePressed()
{
background(0);
redraw();
}