Some Mathematical Topics
This section covers a few topics which have interested me and prompted me to code a solution in assembly. As some of you may well be proficient in other languages you may care to inspect some of the mathematical topics and encode them into the language of your choice. Many of the topics to be discussed here pertain to graphical solutions and will generate an interesting display - which naturally will perform best under assembly. But do experiment and let me know if you produce an interesting variation on any of the covered topics. Links to some sources of mathematical information are provided assist you with your creations.
Orthogonal Circle Construction
By definition a pair of circles are orthogonal to each other if their tangents at the point of intersection are normal to each other (at 90 degrees); see the associated diagram. Then if S designates the centre of the base circle, then by simple geometry it can be shown that the distance to the radial intersection Q, with the circumference of the other orthogonal circle is related to the mirror point Q^{'} (intersection of the radial line with the outer circumference) by the following relationship:- SQ.SQ^{'} =(R_{b})^{2} where R_{b} is the radius of the base circle
Then if X_{b},Y_{b} are the coordinates for the centre of the base circle
X_{n},Y_{n} are the coordinates for the centre of the orthogonal circle
P is the distance from the circumference of the base circle to the centre X_{n},Y_{n} (along the line joining the centres)
We can see that
(X_{n} - X_{b})^{2} + (Y_{n} - Y_{b})^{2} = (R_{b} + P)^{2}
therefore
P^{2} =(X_{n} - X_{b})^{2} + (Y_{n} - Y_{b})^{2} - 2R_{b}P - R_{b}^{2}
or P^{2} + 2R_{b}P + [R_{b}^{2}- (X_{n} - X_{b})^{2} -(Y_{n} - Y_{b})^{2}] = 0
This clearly a quadratic, therefore2P = -2R_{b} ± SQRT( (2R_{b})^{2} - 4[R_{b}^{2} - (X_{n} - X_{b})^{2} - (Y_{n} - Y_{b})^{2}] )
2P = -2R_{b} ± SQRT( 4( (X_{n} - X_{b})^{2} + (Y_{n} - Y_{b})^{2}) )
i.e P= -R_{b} ± SQRT( (X_{n} - X_{b})^{2} + (Y_{n} - Y_{b})^{2})
Then since (R_{b})^{2} + (R_{n})^{2} = (R_{b} + P)^{2}
(R_{n})^{2} =2R_{b}P + P^{2}
therefore R_{n} =SQRT( P(2R_{b} + P) )
This equation is therefore just what we need to calculate the radius of the generated orthogonal circle at the coordinates X_{n},Y_{n}. Examples of orthogonal circle construction are provided in my book "Graphics Programming using Assembly" which is described in the synopsis
Circle Inversion
When we have constructed a set of orthogonal circles about a base circle we can then select one of them as a "mirror" circle and then mathematically invert other circles in it. In the above example two orthogonal circles have been initially constructed about the base circle and the larger of the two is then used as "mirror" circle to create a new circle from the other "target" circle. This new circle will also be orthogonal with respect to the base circle and will be contained within the "mirror" circle.
To compute the construction of the inverted circle we proceed as follows:
First find the coordinates for points L and M, which are the intersection points on the "target" circles circumference with the line running through the centres of the "target" and "mirror" circles.LD = R_{t}cos(ß) and CD = R_{t}sin(ß)
where R_{t} is the radius of the target circle
ß is the angle between the line joining the centres of the mirror and target circle and the horizontal and is easily evaluated as: ß = arctan[ (Y_{m} - Y_{t}) / (X_{m} - X_{t}) ] where X_{m},Y_{m} and X_{t},Y_{t} are the coordinates for the centres of the mirror and target circles respectively.The coordinates of L are therefore (X_{t } - R_{t}cos(ß),Y_{t} - sin(ß) )
and the coordinates of M are (X_{t} + R_{t}cos(ß),Y_{t} + sin(ß) )
therefore SL = SQRT [ (X_{m} - X_{t} + R_{t}cos(ß) )^{2} + (Y_{m} - Y_{t} + R_{t}sin(ß) )^{2} ]
and SM = SQRT [ (X_{m} - X_{t} - R_{t}cos(ß) )^{2} + (Y_{m} - Y_{t} - R_{t}sin(ß) )^{2} ]
Then since SL.SL^{'} = (R_{m})^{2}
SL^{ '} = SL /(R_{m})^{2} and SM^{ '} = SM /(R_{m})^{2} The diameter of the inverted circle is equal to SM ^{ '} - SL ^{ '}Therefore the radius of the inverted circle is given by
R_{i} = (SM ^{'} - SL^{' }) /2
And the location of the centre on the inverted circle is given byX_{i} = X_{m} - [( SL^{ '} + SM^{ '})*cos(ß)] / 2
Y_{i} = Y_{m} - [( SL^{ '} + SM^{ '})*sin(ß)] / 2
With these equations one can write a program for the construction of orthogonal circles and then invert them. If you want an example of this you may wish to download the file Invert5.zip from the downloads section. A Win32 program Invcircs is also available in the download section; it performs a transform on a rectangular array of circles to create a beautiful piece if computer art. If you wish to learn more about orthogonal circles and inversion, check out "The New Scientist Guide to Chaos", which contains a chapter on the subject of geometrical reflections. A splendid example of circle inversion is given by the example "Les parapluies de Verone", which as the name suggests shows an "overhead view" of a host of multicoloured umbrellas; the program is not however given, but could be developed from the above named inversion example.