Tutorial
Circle-Polygon Collision Detection

Circle-Edge Collision Detection

Circle-polygon collision detection can be (mostly) performed by computing circle-edge collision detection for each edge of the polygon. Note: this is for convex polygons.

To perform circle-edge collision detection basic trignometry along with vector operations may be used.

circle-edge.svg

Exercises:

  1. Work out how to calculate d - the perpendicular distance of the circle centre from the edge.
  2. Work out how to test whether the circle intersects the edge.
  3. Implement circle-edge collision detection in the 1D collision detection program - visualise the detection to check.
  4. Now implement collision response.

Further exercises:

  1. There is more to circle-polygon collision detection than just performing circle-edge intersection tests. In particular a circle may collide with one of the vertices rather than the edges. Work out how to handle the circle-vertex case, along with what should be done for collision response.