Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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:

enter image description here

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?

share|improve this question
    
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
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.