/*This function gets the x, y coordinate values for the rectangular area that sorounds a set of geometric objects represented as an array of polygons*/ //The CRect object pointer is used to hold the rectnagular information computed by the function //Note that the variables Start and NumObject allow the user to make selection from within section of the array of objects unsigned int GetObjectsRectangular(unsigned int Start, unsigned int NumObject, struct Polygon Object[ ], CRect *TheRectPtr) { unsigned int i, j = Start; int MaxX, MinX, MaxY, MinY; TheRectPtr->BottomRight().x = GetObjectMaxMinX(Objects[j], True); TheRectPtr->TopLeft().x = GetObjectMaxMinX(Objects[j], False); TheRectPtr->BottomRight().y = GetObjectMaxMinY(Objects[j], True); TheRectPtr->TopLeft().y = GetObjectMaxMinY(Objects[j], False); j++; for(i = j; i < NumObject; i++) { MaxX = GetObjectMaxMinX(Objects[i], True); MinX = GetObjectMaxMinX(Objects[i], False); MaxY = GetObjectMaxMinY(Objects[i], True); MinY = GetObjectMaxMinY(Objects[i], False); if(MaxX > TheRectPtr->BottomRight( ).x) TheRectPtr->BottomRight( ).x = MaxX; if(MinX < TheRectPtr->TopLeft().x) TheRectPtr->TopLeft().x = MinX; if(MaxY > TheRectPtr->BottomRight( ).y) TheRectPtr->BottomRight( ).y = MaxY; if(MinY < TheRectPtr->TopLeft().y) TheRectPtr->TopLeft().y = MinY; } return(i); }