Classes | Geometry

# Rect : Object

Rectangle
Source: Rect.sc

## Class Methods

### Rect.new(left: 0, top: 0, width: 0, height: 0)

Return a new Rect with the given upper left corner and dimensions.

### Rect.newSides(left: 0, top: 0, right: 0, bottom: 0)

Return a new Rect with the given boundaries.

### Rect.fromPoints(pt1, pt2)

Return a new Rect defined by the given Points.

## Instance Methods

### .left = value

Get or set the value of the boundary.

### .top = value

Get or set the value of the boundary.

### .right = r

Get the value of the boundary.

### .bottom = b

Get the value of the boundary.

### .set(argLeft: 0, argTop: 0, argWidth: 0, argHeight: 0)

Set the boundaries to the given values.

### .setExtent(argWidth: 0, argHeight: 0)

Set the dimensions.

### .width = value

Set or get the width.

### .height = value

Set or get the height.

### .origin = pt

Return the upper left corner as a Point.

### .extent = pt

Return a Point whose x value is the height and whose y value is the width.

### .leftTop

Return the upper left corner as a Point.

### .rightTop

Return the upper right corner as a Point.

### .leftBottom

Return the lower left corner as a Point.

### .rightBottom

Return the lower right corner as a Point.

### .moveBy(h, v)

Returns a new Rect which is offset by x and y.

### .moveTo(h, v)

Returns a new Rect whose upper left corner is moved to (x, y).

### .moveToPoint(aPoint)

Returns a new Rect whose upper left corner is moved to aPoint.

### .resizeBy(h, v)

Returns a new Rect whose dimensions have been changed by (x, y).

### .resizeTo(h, v)

Returns a new Rect whose dimensions are (x, y).

### .insetBy(h, v)

Returns a new Rect whose boundaries have been inset by (x, y). If only one argument is supplied, it will be used for both x and y.

### .insetAll(a, b, c, d)

Returns a new Rect whose boundaries have been inset by the given amounts.

### .contains(anObject)

Answers whether aPoint is in the receiver.

### |(aRect)

Returns a new Rect which contains the receiver and aRect.

### &(aRect)

Returns a new Rect which is the intersection of the receiver and aRect.