UnionRect
UnionRect Find smallest rectangle enclosing two rectangles Rect *rect2 ; ... structures to find union Rect * resultRect ; receives union rectangle UnionRect finds the smallest rectangle that will enclose two specified rectangles.
rect1 and . . .
rect2 are the addresses of two 8-byte Rect structures. They should use the same coordinate system.
resultRect is the address of a third Rect structure. Upon return, it will contain the coordinates of a rectangle that encloses both rect1 and rect2 .
Notes: The resultRect will define the minimum rectangle. It basically copies the
topLeft coordinate of the highest, leftmost rectangle and the bottomRight
coordinate of the lowest, rightmost rectangle. In the figures, the
dotted-line rectangles represent the union of the two interior rectangles:
It is OK to specify resultRect as the same rectangle as either of rect1 or
rect2 . For instance, the following code would find the union of rectangles
A and B, and store its coordinates into rectangle A, overwriting the original
value: