Get quadratic function coefficients from height of the curve and distance between roots

73 Views Asked by At

I'm developing a game where fish will jump out of the water, following a quadratic curve (red in the image below).

In my code, assuming the water level is y=0, I have three variables: the width w of the jump (distance between the two roots, a random number between 100 and 300), the height h of the jump (y coordinate of the vertex, a random number between 50 and 150) and the horizontal middle m of the jump (x coordinate of the vertex, a random number between 0 and the screen width). As a consequence, I also know the two roots of the equation.

Having this variables, how do I get the coefficients a, b and c?

definitions of w, h and m