# Coordinates of intersection of circle and sphere

• Mar 25th 2008, 04:57 PM
DSG
Coordinates of intersection of circle and sphere
How do I calculate the x, y, & z coordinates of the two points where a sphere intersects a circle? The coordinates of the center of both are known and the radii are known.

The center of the circle and the center of the sphere are not the same point.

The circle and the sphere are not tangent to each other.

The center of the sphere is not on the perpendicular through the center of the circle. I.e., the solution is not the circle, only two points.

You may orient the circle as a rotation around an axis (but the sphere is not on the axis of rotation of course).

DSG
• Mar 25th 2008, 06:28 PM
Mathnasium
Why not give the specific problem statement (radii, centers, etc) - it would make the explanation much easier, I would think.
• Mar 25th 2008, 07:14 PM
DSG
I was looking for a general equation. The center of the circle can move along a line and will have various radii. The sphere has a fixed center in relation to the line, but it too will have varying radii.
DSG
• Mar 26th 2008, 07:36 AM
Opalg
Quote:

Originally Posted by DSG
How do I calculate the x, y, & z coordinates of the two points where a sphere intersects a circle? The coordinates of the center of both are known and the radii are known.

The center of the circle and the center of the sphere are not the same point.

The circle and the sphere are not tangent to each other.

The center of the sphere is not on the perpendicular through the center of the circle. I.e., the solution is not the circle, only two points.

You may orient the circle as a rotation around an axis (but the sphere is not on the axis of rotation of course).

The given circle C lies in a plane. The plane is determined by the location of the centre of C, together with a normal vector N (is that what you called the axis of rotation?).

The plane containing C will meet the sphere in another circle Γ (assuming that this intersection is not empty). The centre of Γ will be a point P on a line through the centre of the sphere in the direction of N. Using that information, you can find the location of P, and hence its distance d from the centre of the sphere. If the radius of the sphere is r then the radius of Γ will be $\sqrt{r^2-d^2}$ (by Pythagoras).

Now you know the radius of Γ. You can also find the distance between the centres of C and Γ, and you also know the radius of C. So that reduces the whole problem to a simple one of finding the intersection of two circles in a plane.
• Mar 26th 2008, 08:25 AM
DSG
Opalg,
Slicing the sphere into a circle on the same plane as the original circle helped me understand the solution.
Thanks for the help,
DSG
• Mar 26th 2008, 09:59 AM
pbierre
algorithmic geometry solution
For this, you need to have already solved the general intersection of two 2D circles as a 2D algorithm (able to handle all cases):

Given: SPH = [ c r ] CIR = [ c orient r ]
Solve: numIntersectionPts (0,1,2,infinite), i1 i2

1. Translate coordinates adopting CIR.c as newOrigin (compute SPH --> SPH')
SPH' = Translate(CIR.c, SPH)
2. Rotate coordinates adopting CIR.orient as the newZaxis (compute SPH' --> SPH")
Rotator R = RotatorForNewZAt(CIR.orient)
SPH" = Rotate(R, SPH')
3. Now, CIR" lies flat in x"-y" plane centered at origin.
4. Visualize 2nd circle where x"-y" plane cuts thru SPH"
if (abs(SPH".c.z) > SPH.r) numIntersectionPts = 0; return; // SPH too distant from x'=y" plane
5. Solve i1" i2" in 2D as the intersection of these two circles:
cir1 = [ 0 0 ] CIR.r
cir2 = [ SPH".c.x SPH".c.y ] sqrt(sqr(SPH.r) - sqr(SPH".c.z))
numIntersectionPts = IntersectionOf(cir1, cir2, /*returns*/ i1", i2")
6. If numIntersectionPts == 1 or 2,
back-transform solution points into original coordinates:
i1 = Untranslate(CIR.c, Unrotate(R, i1"))
i2 = Untranslate(CIR.c, Unrotate(R, i2"))

This is a general solution (works in all cases).

Illustrated solution in: Flexing the Power of Algorithmic Geometry by Pierre Bierre
• Mar 28th 2008, 05:19 AM
DSG
Thanks Pierre.
DSG