00:02
Okay, for this problem, they'd like us to find a bounding rectangle for a list of points, and then they want that to be converted to the rectangle 2d class that we wrote back in chapter 7, and they'd like us to print out the center and height and width of that rectangle.
00:23
I've written here just our little test program that will collect the input from the user, the list of points, we have to go every other point to collect the xy pairs.
00:39
They also need to be converted to floats.
00:41
We then call our function get rectangle and then print out the requested values.
00:52
To write our get rectangle function, essentially what we're going to do is we're just going to find the largest and the smallest of each of the x and y sets.
01:04
And those are going to be the corners of our bounding box.
01:07
And then from there, we can compute the center, the height and width of the rectangle, and make the actual rectangle.
01:14
I'm going to write a couple utility functions to help with finding the center and getting the length.
01:24
So you get the center, assuming that we have a max and a min.
01:31
I'm going to return the sum, and then divide by two.
01:51
And then for length, we're just going to return the difference...