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.
Exercises:
-
Work out how to calculate d∥ - the perpendicular distance of
the circle centre from the edge.
-
Work out how to test whether the circle intersects the edge.
-
Implement circle-edge collision detection in the 1D collision
detection program - visualise the detection to check.
-
Now implement collision response.
Further exercises:
-
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.