How can I calculate the bounding box corners for a group of xy coordinates?

I have a group of xy coordinates. For example:

10, 34
20, 45
20, 50
10, 20
10, 56
...

How can I calculate the bounding box corners for that coordinates?

Answers


To get the bounding box with sides parallel to the XY-axes you simply need to find the min/max of all the x and y koordiantes:

minx = min(xcoords);
maxx = max(xcoords);
miny = min(ycoords);
maxy = max(ycoords);

The bounding box has corners in (minx, miny), (minx, maxy), (maxx, maxy), (maxx, miny).


The following Wikipedia page offers some insights on algorithms used to find the minimum oriented bounding rectangle (2D) and box (3D): http://en.wikipedia.org/wiki/Minimum_bounding_box_algorithms


Need Your Help

Efficient way to search a SharePoint List

c# asp.net sharepoint sharepoint-2010

I have a SharePoint list with columns as below:

Type safe parameter in method

java android annotations type-safety

I'm using a library which provides custom Views. I want to create a method that accepts only custom Views from this library.