[comp.graphics] The circle going through 3 points.

sumane@anaconda.stanford.edu (Thilaka Sumanaweera) (08/17/89)

I think the following is a solution to the problem of drawing
the circumcircle of a triangle:

                     A
                    /\
                   /  \
                  /    \             Let AB = c, BC = a, AC = b,  
                 /      \                 s = a + b + c;
              b /        \
               /          \ c
              /     O      \
             /      |       \
            /       |        \
           /        |         \
          /         |          \
         /          |90         \
        C-----/-----|-----/------B
                a   X

Then the radius of the circumcircle, R is given by:

                       square(a).square(b).square(c)
	square(R) = ----------------------------------
                         s(s - 2a)(s - 2b)(s - 2c)

and     OX = OC.sin(OCX) = R.sin(OCX)     where	
 
                    s(s - 2a)
	sin(OCX) = -----------   -  1
                      2.b.c

so vectorially,

            B + C
	O = ----- +  OX.q   where q is a unit vector perpendicular to BC
              2             and towards the inside of the triangle.

Thilaka