Cone-sphere intersection test

Directory
Cone-sphere test
Notes
See also
Copyright
My home page

The method takes the perpendicular distance from the axis of the cone to the centre of the sphere and compares this to the maximum distance for intersection. The maximum distance (given the perpendicular through the centre of the sphere) is related to:

1. the cone's interior angle, θ
2. the distance of the perpendicular from the cone's vertex, p
3. the radius of the sphere, r

using the formula     r + p sin(θ)
------------
cos(θ)

Demonstration

In the diagram, the axis of the cone is VA, with vertex V. The perpendicular from the axis through the centre of the sphere (C) intersects VA at W, is of length |CW| and lies a distance of |VW| from the vertex of the cone (distance p on the diagram). The distance |WX| to the edge of the cone, also marked q on the diagram, is p by tan(θ), where θ is the interior angle of the cone.

When the sphere and cone touch at exactly one point, marked Y on the diagram, the line VY is tangential to the sphere, and forms a right angle with the radius YC. This radius forms an angle with the perpendicular CW that is identical to the cone's interior angle θ (the opposite angles at X being equal). This gives a distance (marked m on the diagram) of r/cos(θ) from C along CW to the edge of the cone. The total distance q+m is ptan(θ)+(r/cos(θ)), which simplifies to:

 r + p sin(θ)
 ------------
    cos(θ)
This is the maximum perpendicular distance from the axis of the cone to the centre of the sphere for which the figures intersect. It is then trivial, for a sphere at an arbitrary location, to calculate the perpendicular distance (e.g. using the vector projection) and compare it to the maximum distance for intersection using the formula above.

Notes

The result relies on the assumption that the length |CW| is equal to m + q, which holds so long as W, X and C are co-linear. Well, I'm reliably informed that touching solids share a common normal at the point of contact (Y in this case). The radius CY is normal to the surface of the sphere, and is therefore also normal to the surface of the cone. This means that its extension intersects the cone's axis, say at a point Z (not shown) which is co-linear with V, W and A. I believe it follows that all of the points shown on the diagram are co-planar, which is just as well since the diagram is only two-dimensional.

See also

See also an alternative method (with implementation in C++) at
Magic Software

Copyright

This page is copyright (c) 2003 by Raoul Gough. Please send any comments or requests to
RaoulGough@yahoo.co.uk.