A Fast Circle Drawing Method
After creating a fast line drawing method I started to look at fractals and other geometric objects. It is easy to use sine and cosine functions to draw circles, but suppose you wanted to draw a circle using only addition and multiplication. No higher level functions are allowed. Can you think of a simple way of doing this?
Here's a clue: the planets have traveled in elliptical orbits around the Sun for billions of years and if we ignore the n-body formulation of Newton's equations for gravity and only consider the planet part of the differential equations, perhaps this will provide some direction.
Around 1986 I was thinking about this problem. I came up with a solution for the Motorola VME-10 I was using at the time. Here is a link to a Borland Studio 2006 C++ project that does this trick on a modern PC (includes ready to run EXE file). The PGRAPH.SA file is the VME-10 graphics subroutines and CPLOT.SA is the circle drawing routine as they existed in 1989. The Motorola salesman liked this graphics demo so much he started to use it to show off the VME-10's graphic abilities at electronics shows. If you ever saw the VME-10 at a show drawing circle graphs like the following, it was possibly my program at work.
This program solves a dimensionless gravity like differential equation using Euler's method, the most simple way to solve differential equations. It actually solves two such equations and superimposes the results to produce the plot. This produces rather interesting plots on the screen when you add friction to cause decay in the orbits:
This method can be used to draw circles or ellipses of any size easily and quickly (the dT value shows the drawing time of 5.5 milliseconds). Here is an example of a 350 x 250 ellipse. The line is a little thicker than 1 pixel because the ellipse has been drawn hundreds of times and there is a little error jitter in the solution provided by Euler's method. A single rotation produces a single pixel wide plot and would be very close (within 1 pixel) of what you could produce using sine and cosine functions.
To produce the 3-dimensional like drawings we need to use both the circles. The #1 ellipse is set to a large size and the #2 ellipse is smaller. The CX variable is similar to mass or the force of gravity. Ratios between CX for the two systems can produce either chaos or 3-dimensional like drawings. The Phase and Angle variables add rotation of the coordinate system and initial conditions. The CV variable is a friction constant and will produce faster decay of the orbit if increased.
Ratios of CX like 1:4, 1:9, 1:16, 1:25 and 1:36 produce the 3-dimensional style of plots. Have some fun with this and if you need to do fast circle or ellipse drawing, feel free to use this idea.