Straight to the point elipse drawing?

59 Views Asked by At

Ive been looking everywhere for a simple way of drawing elipses. However im unable to find any site that will show the algorithm in a simple straight forward way. They clutter it up with all the math that goes into it, and that just goes way above my head.

The same was true for lines and circles (check out wikipedias explanation, and compare it to this.

Can someone provide me with an algorithm that is pres

2

There are 2 best solutions below

0
On

A simple way to draw draw one is to get a loop of string, place 2 pins at the focii then wrap the string around the pins and a pen, then while holding outward tension with the pen draw looping it around.

Now if you are talking about getting a computer to draw it using an algorithm then I'm sorry that algorithm will use the math you are trying to avoid and no it won't accept requests to get simpler.

You can however use graphics libraries that abstract away the math. E.g. OpenGL is used for 3D drawing and an ellipse can be made just by stretching a circle about one axis. For the 2D case there is cairo graphics. Both solutions are cross platform (windows linux mac).

0
On

Here is an algorithm in pseudo-code to draw an ellipse of width $2a$ and height $2b$:

moveTo (a,0)

for(t=0; t<6.2832; t+= 0.01){
   drawLineTo ( a*cos(t), b*sin(t) )
}

If you don't want to spend the cost of evaluating sines and cosines (but with a slight loss of accuracy) you can try

moveTo (a,0); x=a; y=0; d=0.1

for(t=0; t<=100; t++){
    x -= d*a*y/b;
    y += d*b*x/a;
    drawLineTo (x,y)
}

(You might have to experiment with the 100 and the value of $d=0.1$.)