-1

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?

Joncom
  • 1,985
  • 1
  • 18
  • 29
  • 1
    Doesn't your graphics library have a function for drawing ellipses to which you could pass the center (x,y) and the dimensions (a,b)? If not look up ellipse drawing algorithms, they are more complex than that formula and they are orders of magnitude faster. – Dan D. Oct 15 '12 at 01:38
  • 1
    Instead of asking how to plug in values to a formula, you should find out how to draw an ellipse in whatever language you're working in. That will tell you a lot more than the first equation you find on Wikipedia. – Bill the Lizard Oct 15 '12 at 01:39
  • Hint: what happens when x=0? And what happens when y=0? – Beta Oct 15 '12 at 01:49

1 Answers1

0

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.

Joncom
  • 1,985
  • 1
  • 18
  • 29