Search code examples
mathgeometryshapeskinematics

Where to put static and variable values in this equation of an ellipse?


From Wikipedia, here's the equation of an ellipse:

Equation of an ellipse

I want all ellipses to have a width of 240 pixels.

And want to the height of all ellipses to be a value between 10 and 60 pixels which will be randomly generated.

Something like this:

Ellipses

My questions is where do I plug in the 240, and where do I plug in my randomly generated height values?


Solution

  • a and b are the radii of the ellipse.

    This is the answer I was looking for:

    x^2 / (240/2)^2 + y^2 / (h/2)^2 = 1

    .. where h = randomly generated height between 10 and 60.

    Because an ellipse has two radii, instead of just one in the case of a circle.