Next: , Previous: , Up: Rectangle   [Index]

#### 1.142.5 Rectangle: rectangle functions

amountToTranslateWithin: aRectangle

Answer a Point so that if aRectangle is translated by that point, its origin lies within the receiver’s.

area

Answer the receiver’s area. The area is the width times the height, so it is possible for it to be negative if the rectangle is not normalized.

areasOutside: aRectangle

Answer a collection of rectangles containing the parts of the receiver outside of aRectangle. For all points in the receiver, but outside aRectangle, exactly one rectangle in the collection will contain that point.

expandBy: delta

Answer a new rectangle that is the receiver expanded by aValue: if aValue is a rectangle, calculate origin=origin-aValue origin, corner=corner+aValue corner; else calculate origin=origin-aValue, corner=corner+aValue.

insetBy: delta

Answer a new rectangle that is the receiver inset by aValue: if aValue is a rectangle, calculate origin=origin+aValue origin, corner=corner-aValue corner; else calculate origin=origin+aValue, corner=corner-aValue.

insetOriginBy: originDelta corner: cornerDelta

Answer a new rectangle that is the receiver inset so that origin=origin+originDelta, corner=corner-cornerDelta. The deltas can be points or numbers

intersect: aRectangle

Answers the rectangle (if any) created by the overlap of rectangles A and B. Answers nil if the rectangles do not overlap

merge: aRectangle

Answer a new rectangle which is the smallest rectangle containing both the receiver and aRectangle.

translatedToBeWithin: aRectangle

Answer a copy of the receiver that does not extend beyond aRectangle.