Containing circle

One of the necessities for performing real-time collision detection is to simplify a given shape. For this reason, we need to make a function that, given a set of points, will return a circle containing all the points. This simplified bounding circle can then be used to approximate a collision area:

Containing circle

Getting ready

In order to avoid adding a dependency to std::vector in Geometry2D.h, we will implement this new function using an array. The ContainingCircle function will take two arguments, one is a Point2D array, and the other deals with the number of elements in the array. The ContainingCircle function will return a bounding circle ...

Get Game Physics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.