# Collision detection of two circular sectors in mixed polar and Cartesian coordinate

I am trying to solve the following collision detection problem. Suppose we have two circular sectors, each described in their own polar coordinate system with four values $r_1$, $r_2$, $d_1$ and $d_2$, where $r_1$ and $r_2$ ($r_2 \ge r_1$) are angles and $d_1$ and $d_2$ ($d_2 \ge d_1$) are two distances from the polar origin sandwiching the sector. The two sectors are placed on a 2-D Cartesian plane, each described with a coordinate $(x,y)$ (See illustration below).

Illustration:

The problem is to detect whether the two sectors collide. One trivial case is if the sum of the two $d_2$'s is greater than distance of two Cartesian points $\sqrt {(x_1 - x_2)^2 + (y_1 - y_2)^2}$, then the two shapes do not collide. I have yet to figure out how to solve rest of the problem (I thought of using the midline of $r_1$ and $r_2$, but can't exactly figure out how). Any ideas or suggestions?

-
I have formatted your question, and am using variables like $x_1$ instead of $x1$ as in your figure, since that is more common. Please feel free to change it back if you want. – Paresh Dec 3 '12 at 6:02

## 1 Answer

Two sectors collide if and only if at least one of the following is true:
1. Borders of sectors intersect each other (border = union of four lines)
2. Random inner point of sector1 (e.g., center) lies within sector2
3. Random inner point of sector2 (e.g., center) lies within sector1

Borders intersection detection is simple, you need 16 attempts (all combinations of 4 lines * 4 lines) to get the answer.
The last two conditions are necessary in case of one sector lies completely inside another without borders intersection.

-