I have to find the exact centroid of multiple rectangles (Minimum Bounded Rectangle). Let I have, 3 rectangles and their co-ordinates for the maximum and minimum points
1st rectangle's minimum point (x1,y1) , maximum point (x2,y2)
2nd rectangle's minimum point (x3,y3) , maximum point (x4,y4)
3rd rectangle's minimum point (x5,y5) , maximum point (x6,y6)
I quick solution come over my mind is , I will find possible list of centroids by considering combinations of this 6 points and then take the minimum bounded rectangle of those centroids. It will give me a rectangle R , the centroid of that rectangle is my real centroid.
For example , a combination is (x1,y1)+(x3,y3)+(x5,y5) ,
another combination is (x1,y1)+(x3,y3)+(x6,y6) etc
But i am confused will it give me the real centroid ? Is there any other way to find the centroid ?