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?
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).
以下Wikipedia页面提供了有关用于查找最小定向边界矩形(2D)和矩形框(3D)的算法的一些见解: http : //en.wikipedia.org/wiki/Minimum_bounding_box_algorithms
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.