Sphere-rectangle intersection

1.6k Views Asked by At

I have the following problem:

I have a sphere I need to check whether it is intersecting a finite plane or not. The information I have on the plane is its implicit equation and its extent defined in $x,y,z$. Is there any quick way to determine if there is an intersection between them or I have to rely on the more expensive generic sphere/polygon intersection?

Thanks, Jack

2

There are 2 best solutions below

1
On

Standard vector algebra can find the distance from the center of the sphere to the plane. If that's less than the radius, they intersect.

Whether it meets a particular rectangle in that plane is a little more work. You can find the circle in which the sphere meets the plane. Then it's a two dimensional problem. Here's a tedious but straightforward approach to that. I'll assume you've figured out the center and radius of the circle and have the vertices of the rectangle.

Imagine the edges of the rectangle produced to make this tic-tac-toe board picture

C  |  E  |  C
--------------
E  |  X  |  E
--------------
C  |  E  |  C

Then find out which region contains the center $O$ of the circle (that's just checking some inequalities using the equations of the edges of the rectangle).

If $O$ is in the X region you're done. If it's in a C region, check to see if the near corner is in the circle. If it's in an E region, check that the distance to the edge is less than or equal to the radius.

0
On

Let $C (x_0,y_0,z_0)$ be the center of the sphere and $R$ its radius.

Whatever the way you "know" the plane $(P)$, in my opinion, the most direct way is

1) First, compute its equation under the form $ax+by+cz+d=0$

2) Then compute the distance $\delta$ from $C$ to plane $(P)$ and check that plane (P) intersects the sphere if and only if $\delta$ is less than $R$, by using a classical formula :

$$\delta=\dfrac{|ax_0+by_0+cz_0+d|}{\sqrt{a^2+b^2+c^2}}<R$$