Circles and Spheres

Steven Dutch, Natural and Applied Sciences, Universityof Wisconsin - Green Bay
First - time Visitors: Please visit Site Map and Disclaimer.Use "Back" to return here.


Circles and spheres are of major importance in geological mathematics. We live on asphere, after all, and we conventionally represent the heavens in spherical coordinates.We define strain in terms of the deformation of a circle, plot structural andcrystallographic data on spheres, and so on.

Circles in the Plane

Center at Origin, Radius r

Center at Arbitrary Point (h,k), Radius r

General Form x*x + y*y + 2*d*x + 2*e*y + f = 0

Parametric Form, Radius r

This is probably the most useful form for drawing a circle. It eliminates the need toallow for both positive and negative square roots.

Circle with a Given Line as Diameter

If the diameter of the circle is the line with endpoints (x1, y1) and (x2, y2), theequation of the circle is:

We can see that the center of the circle lies at:

Three - point Form

A circle which passes through three points (x1,y1),(x2,y2) and (x3,y3) has the equation

         |x*x + y*y       x    y    1|        |x1*x1 + y1*y1   x1   y1   1| = 0        |x2*x2 + y2*y2   x2   y2   1|        |x3*x3 + y3*y3   x3   y3   1|

The formula is complicated, and it is probably best to find the center and radius. Thecenter (h,k) must be computed piecemeal. In programming terms:

REM find h
h = x1*x1*(y2 - y3) + x2*x2*(y3 - y1) + x3*x3*(y1 - y2)
h = h - (y1 - y2)*(y2 - y3)*(y3 - y1)
h = h/(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2))
h = h/2
REM find k
k = y1*y1*(x2 - x3) + y2*y2*(x3 - x1) + y3*y3*(x1 - x2)
k = k - (x1 - x2)*(x2 - x3)*(x3 - x1)
k = k/(y1*(x2 - x3) + y2*(x3 - x1) + y3*(x1 - x2))
k = k/2

Having computed the location of the center, the easiest way to find the radius is bysubstituting one of the three points into the general formula for a circle. Thus:

r = sqr((x1 - h)*(x1 - h) + (y1 - k)*(y1 - k))


Spheres

Center at Origin, Radius r

Center at Arbitrary Point (h,k,l), Radius r

General Form x*x + y*y + z*z + 2*d*x + 2*e*y + 2*f*z + m = 0

Note: to reduce the formula to this form divide by the coefficient of the square term. If the formula can't be reduced to this form, the figure is an ellipsoid, not a sphere.

Sphere with a Given Line as Diameter

If the diameter of the sphere is the line with endpoints (x1, y1, z1) and (x2, y2, z2),the equation of the sphere is:

From the General Form, we can see that the center of the circle lies at
x = (x1 + x2)/2, y = (y1 + y2)/2, z = (z1 + z2)/2.

Its radius is
r = sqr((x1*x1) + (x1*x2) + (x2*x2) + (y1*y1) + (y1*y2) + (y2*y2) + (z1*z1) + (z1*z2) +(z2*z2))

Four - Point Form

A sphere which passes through four points (x1,y1,z1), (x2,y2,z2), (x3,y3,z3), and(x4,y4,z4) has the equation

         |x*x + y*y + z*z         x   y   z   1|        |x1*x1 + y1*y1 + z1*z1   x1  y1  z1  1|        |x2*x2 + y2*y2 + z2*z2   x2  y2  z2  1| = 0        |x3*x3 + y3*y3 + z3*z3   x3  y3  z3  1|        |x4*x4 + y4*y4 + z4*z4   x4  y4  z4  1|

We can expand the determinant as follows. First, substitute r1 = x1*x1 + y1*y1 + z1*z1,and so on. We then have

         |x*x + y*y + z*z  x  y  z  1|        |        r1      x1 y1 z1  1|        |        r2      x2 y2 z2  1| = 0        |        r3      x3 y3 z3  1|        |        r4      x4 y4 z4  1|

The determinant expands along the top row to:

                              |x1   y1   z1   1|         (x*x + y*y + z*z) * |x2   y2   z2   1|                             |x3   y3   z3   1|                             |x4   y4   z4   1|             |r1   y1   z1   1|      |r1   x1   z1   1|        - x *|r2   y2   z2   1| + y *|r2   x2   z2   1|             |r3   y3   z3   1|      |r3   x3   z3   1|             |r4   y4   z4   1|      |r4   x4   z4   1|             |r1   x1   y1   1|     |r1   x1   y1   z1|        - z *|r2   x2   y2   1|  +  |r2   x2   y2   z2|             |r3   x3   y3   1|     |r3   x3   y3   z3|             |r4   x4   y4   1|     |r4   x4   y4   z4|

We now have the equation in a form similar to the General Form, and we can rewrite theabove formula as follows:

x*x + y*y + z*z + (d1/d0)*x + (d2/d0)*y + (d3/d0)*z + (d4/d0) = 0

where d0...d4 represent the determinants in the expansion above in the order given.

To determine the geometry of the sphere, we need to expand the determinants accordingto the following routine:

REM CALCULATE DETERMINANTS
REM INITIALIZE D0 = 0:D1 = 0:D2 = 0:D3 = 0:D4 = 0
REM CALCULATE D0 D0 = (x2 - x1)*((y3 - y1)*(z4 - z1) - (y4 - y1)*(z3 - z1)
D0 = D0 - (x3 - x1)*((y2 - y1)*(z4 - z1) - (y4 - y1)*(z2 - z1)
D0 = D0 + (x4 - x1)*((y2 - y1)*(z3 - z1) - (y3 - y1)*(z2 - z1)
REM CALCULATE D1
D1 = (R2 - R1)*((y3 - y1)*(z4 - z1) - (y4 - y1)*(z3 - z1)
D1 = D1 - (R3 - R1)*((y2 - y1)*(z4 - z1) - (y4 - y1)*(z2 - z1)
D1 = D1 + (R4 - R1)*((y2 - y1)*(z3 - z1) - (y3 - y1)*(z2 - z1)
REM CALCULATE D2
D2 = (R2 - R1)*((x3 - x1)*(z4 - z1) - (x4 - x1)*(z3 - z1)
D2 = D2 - (R3 - R1)*((x2 - x1)*(z4 - z1) - (x4 - x1)*(z2 - z1)
D2 = D2 + (R4 - R1)*((x2 - x1)*(z3 - z1) - (x3 - x1)*(z2 - z1)
REM CALCULATE D3
D3 = (R2 - R1)*((x3 - x1)*(y4 - y1) - (x4 - x1)*(y3 - y1)
D2 = D2 - (R3 - R1)*((x2 - x1)*(y4 - y1) - (x4 - x1)*(y2 - y1)
D2 = D2 + (R4 - R1)*((x2 - x1)*(y3 - y1) - (x3 - x1)*(y2 - y1)
REM CALCULATE D4
D4 = R1*(x2*(y3*z4 - y4*z3) + x3*(y4*z2 - y2*z4))
D4 = D4 + R1*(x4*(y2*z3 - y3*z2))
D4 = D4 - R2*(x1*(y3*z4 - y4*z3) + x3*(y4*z1 - y1*z4))
D4 = D4 - R2*(x4*(y1*z3 - y3*z1))
D4 = D4 + R3*(x1*(y2*z4 - y4*z2) + x2*(y4*z1 - y1*z4))
D4 = D4 + R3*(x4*(y1*z2 - y2*z1))
D4 = D4 - R4*(x1*(y2*z3 - y3*z2) + x2*(y3*z1 - y1*z3))
D4 = D4 - R4*(x3*(y1*z2 - y2*z1))
REM CALCULATE RADIUS
R = SQR(D1*D1 + D2*D2 + D3*D3 - 4*D4*D4))/(2*D0)
REM LOCATE CENTER
x = D1/(2*D0)
y = D2/(2*D0)
z = D3/(2*D0)


Return to Course Syllabus
Return to Techniques Manual Index

Return to Professor Dutch's Home Page
Created 22 January 1999, Last Update 15 January 2020
Not an official UW Green Bay site