Share | home | contents | send comment | send link | add bookmark |

Circle Intersection Solver

by Stephen R. Schmitt

Circle 1:   x2 + y2 x +  y +   = 0,
Circle 2:  x2 + y2 x +  y +   = 0.

Contents

  1. About
  2. The source code
  3. Discussion

1. About

This is a Java Script calculator that computes the intersection points of two circles in a plane.

To operate the calculator, enter the parameters for the circle in general form. Press the Compute button to calculate the point(s). The result will be displayed in a new window. The Test button inserts a test case into the coefficient windows.

On invalid entries, the Message windows will display an error message.

Return to Contents


2. The source code

The Java Script source code for this program can be viewed by using the View|Source command of your web browser.

You may use or modify this source code in any way you find useful, provided that you agree that the author has no warranty, obligations or liability. You must determine the suitability of this source code for your use.

Return to Contents


3. Discussion

A general form for the equation of a circle is:

x² + y² + Dx + Ey + F = 0.

The center and radius can be obtained by completing the squares:

æ
è
x² + Dx D² ö
ø
 +  æ
è
y² + Ey E² ö
ø
 = −F D²  +  E²
4 4 4 4

or

æ
è
x D ö
ø
²  +  æ
è
y E ö
ø
²  =  D² + E² − 4F  ·
2   2   2

Since the sum of the squares of two real numbers is positive or zero, the left-hand member is positive or zero if x, y, D, E are real numbers. Hence the equation can be satisfied by real coordinates x, y only if D² + E² − 4F is a positive number or zero.

If D² + E² − 4F is positive, the equation represents a circle with center

C = (−D/2, −E/2)

and radius

r = 12   D² + E² − 4F 

If D² + E² − 4F is zero, the equation represents the point (−D/2, −E/2).

If D² + E² − 4F is negative, the equation represents no real locus.

The calculator computes the center and radius for both circles in order to compute the points of intersection of two circles.

The centers of the two circles and the points of intersection (when there are two) form a geometric figure called a convex kite. In geometry, a kite is a quadrilateral with two pairs of congruent adjacent sides. Equivalently, a kite is a quadrilateral with an axis of symmetry along one of its diagonals. A kite may be either convex or concave. The following properties of convex kites allow us to compute the location of the intersection:

  (1) The two diagonals of a kite are perpendicular;

  (2) One diagonal divides a convex kite into two isosceles triangles; the other (the axis of symmetry) divides the kite into two congruent triangles.

The distance between the centers of the circles is given by:

d  (x1x2)² + (y1y2

If d is greater than the sum of the circles' radii, r1 + r2,  then there are no solutions because the circles are too far apart; if d is less than the difference of the circles' radii |r1r2|,  then there are no solutions because one circle is entirely within the other; if d = r1 + r2,  then there is one solution because the circles touch at one point; otherwise there are two solutions.

The intersection points are found by applying the Pythagorean Theorem.

Another method for finding the points of intersection is to subtract one circle equation from the other to obtain a linear equation in x and y. Then the points are found in the same manner as finding the intersections of a circle and a straight line.

Return to Contents


Share | home | contents | send comment | send link | add bookmark |


Copyright © 2008, Stephen R. Schmitt