As an input, I receive some planar, triangulated geometry. Now, I need to compute the four coordinates of the corners of the bounding rectangle. Any Ideas?
Asked
Active
Viewed 137 times
1 Answers
1
I'm going to assume that you mean 2D space in the question title, because everything else refers to 2D.
Go through all the vertices (x,y) in your geometry, and calculate the maximum and minimum of the x's, and the max and min of the y's.
Then the vertices of your bounding rectangle will be (min_x,min_y), (max_x,min_y), (max_x, max_y), and (min_x, max_y).

brainjam
- 18,863
- 8
- 57
- 82
-
1Unless the rectangle can be rotated :) OP never specified – BlueRaja - Danny Pflughoeft Jun 23 '10 at 21:23