# How to create Parabola?

So I’m doing a project for school (only been using processing for a week or two), and I’ve been tasked with creating a program that can draw Bézier curves (which i kinda sorted out), and parabolas (preferably on top of eachother). The thing is, i just can’t figure out how to get processing to actually calculate or draw a parabola. I’ve read some people saying i need to use ‘point’, but I couldn’t find any information saying this works.
Anybody got some info that could help?
Thanks

My code so far:

``````float P0x =100;
float P0y = 260;
float P1x = random(1, 1280);
float P1y = random(1, 720);
float P2x = random(1, 1280);
float P2y = random(1, 720);
float a = 12;
float b = 13;
float c = 14;
float x = 15;
float fx = a*(x*x)+b*x+c;

void setup() {

size (1280, 720);
noFill();
strokeWeight(5);
stroke(66, 133, 244);
line(P0x, P0y, P1x, P1y);
line(P1x, P1y, P2x, P2y);
stroke(234, 67, 53);
bezier(P0x, P0y, P1x, P1y, P1x, P1y, P2x, P2y);

stroke(0);
fx = a*(x*x)+b*x+c;
}
``````
1 Like

Do you know how to make a parable in maths?

Make a for loop x from -100 to 100

then say

``````
float scale = 0.08;
float y = scale * (x*x);
``````

Then `point (x, height-y);` (which maps the y-value upside down)

After this, close the for loop `}`

at the start of `draw()` say `translate(width/2, -30);`

2 Likes

fx is my y; the rest see above

Chrisir