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

Orthogonal circles

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' =(Rb)2     where Rb is the radius of the base circle

Then if  Xb,Yb  are the coordinates for the centre of the base circle

             Xn,Yn  are the coordinates for the centre of the orthogonal circle

             P  is the distance from the circumference of the base circle to the centre Xn,Yn  (along the line joining the centres)

We can see that

             (Xn - Xb)2  +  (Yn - Yb)2 =  (Rb + P)2


             P2 =(Xn - Xb)2  + (Yn - Yb)2  - 2RbP  - Rb2

or         P2 + 2RbP  + [Rb2-  (Xn - Xb)2  -(Yn - Yb)2]  = 0   

This clearly a quadratic, therefore

            2P = -2Rb ± SQRT( (2Rb)2 - 4[Rb2 - (Xn - Xb)2 - (Yn - Yb)2] ) 

            2P = -2Rb ± SQRT( 4( (Xn - Xb)2 + (Yn - Yb)2) )

i.e           P=  -Rb ± SQRT( (Xn - Xb)2 + (Yn - Yb)2)

Then since       (Rb)2 + (Rn)2  = (Rb + P)2

                       (Rn)2 =2RbP  + P2

therefore           Rn =SQRT( P(2Rb + P) )

This equation is therefore just what we need to calculate the radius of the generated orthogonal circle at the coordinates Xn,Yn. Examples of orthogonal circle construction are provided in my book "Graphics Programming using Assembly" which is described in the synopsis

Circle Inversion

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 = Rtcos(ß)  and  CD = Rtsin(ß)

where Rt 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[ (Ym - Yt) / (Xm - Xt) ]   where Xm,Ym  and  Xt,Yt  are the coordinates for the centres of the mirror and target circles respectively.

The coordinates of  L are therefore  (X - Rtcos(ß),Yt  - sin(ß) )

       and the coordinates of  M are  (Xt + Rtcos(ß),Yt + sin(ß) )

therefore     SL = SQRT [ (Xm - Xt + Rtcos(ß) )2 + (Ym - Yt + Rtsin(ß) )2 ]

and            SM = SQRT [ (Xm - Xt  - Rtcos(ß) )2 + (Ym - Yt - Rtsin(ß) )2 ]

Then since  SL.SL' = (Rm)2

                  SL ' = SL /(Rm)2   and   SM ' = SM /(Rm)2

The diameter of the inverted circle is equal to  SM ' - SL '

Therefore the radius of the inverted circle is given by

                   Ri = (SM ' -  SL' ) /2

And the location of the centre on the inverted circle is given by

                   Xi = Xm -  [( SL ' + SM ')*cos(ß)] / 2

                   Yi = Ym -  [( 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 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.