Define a bounding box of an array of points

I have a set of points in an array. All points have x and y coordinates. How can I get the bounding box of this set? The rectangle object must have properties such as x, y, width, height. Any ideas?

+3
source share
2 answers

Save min and max x and do the same with y. Now you have your own rectangle.

+3
source

Find max x in the set, find min x in the set. Find max y in the set, find min y in the set. There is your bounding box ...

+1
source

All Articles