A naive line-drawing algorithm
The simplest method of screening is the direct drawing of the equation defining the line.
dx = x2 - x1 dy = y2 - y1 for x from x1 to x2 { y = y1 + dy * (x - x1) / dx plot(x, y) }
It is here that the points have already been ordered so that {\displaystyle x_{2}>x_{1}}. This algorithm works just fine when {\displaystyle dx>=dy} (i.e., slope is less than or equal to 1), but if {\displaystyle dx<dy} (i.e., slope greater than 1), the line becomes quite sparse with lots of gaps, and in the limiting case of {\displaystyle dx=0}, only a single point is plotted.
CIRCLE:
Algorithm
1.Get the coordinates of the center of the circle and radius, and store them in x, y, and R respectively. Set P=0 and Q=R.
2.Set decision parameter D = 3 – 2R.
3.Repeat through step-8 while X < Y.
4.Call Draw Circle (X, Y, P, Q).
5.Increment the value of P.
6.If D < 0 then D = D + 4x + 6.
7.Else Set Y = Y + 1, D = D + 4(X-Y) + 10.
8.Call Draw Circle (X, Y, P, Q).