Containing rectangle
A containing rectangle is very similar to a containing circle. We will find the minimum non-oriented rectangle that contains a set of points. Depending on the shape being contained, a rectangle might be a tighter fit than a circle:
Getting ready
The ContainingRectangle
function is going to be very similar to the ContainingCircle
function. Just like ContainingCircle
, this function will take an array of points, and a count of the number of points in the array. Given this set of input points, ContainingRectangle
will return the minimum non-oriented rectangle that encompasses every point.
How to do it…
Follow these steps to create a ...
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.