Rectangular shape.

This class is used to define any arbitrary rectangular shape. Note that this class only describes the rectangular shape but does not hold any content.

- Value parameters:
- height
Height of the rectangular.

- width
Width of the rectangular.

- x
X-coordinate of the left top corner.

- y
Y-coordinate of the left top corner.

- See also:
CPArray2D 2D content holder.

- Companion:
- object
- Source:
- CPRect.scala

## Value members

### Constructors

Creates rectangle from two tuples.

Creates rectangle from two tuples.

- Value parameters:
- p1
XY-coordinate of the top left corner.

- p2
XY-coordinate of the bottom right corner.

- Source:
- CPRect.scala

Creates rectangle from two tuples.

Creates rectangle from two tuples.

- Value parameters:
- p1
XY-coordinate of the top left corner.

- p2
XY-coordinate of the bottom right corner.

- Source:
- CPRect.scala

Creates rectangle.

Creates rectangle.

- Value parameters:
- dim
Dimension of the rectangle.

- x
X-coordinate of the top left corner.

- y
Y-coordinate of the top left corner.

- Source:
- CPRect.scala

Creates rectangle with `(0,0)`

left top corner and given dimension.

Creates rectangle with `(0,0)`

left top corner and given dimension.

- Value parameters:
- dim
Rectangle dimension.

- Source:
- CPRect.scala

### Concrete methods

Whether or not given point is contained within this rectangle. This includes a point on the edge of the rectangle.

Whether or not given point is contained within this rectangle. This includes a point on the edge of the rectangle.

- Value parameters:
- a
X coordinate.

- b
Y coordinate.

- Source:
- CPRect.scala

Tests whether this rectangle contains given rectangle.

Tests whether this rectangle contains given rectangle.

- Value parameters:
- rect
Rectangle to test.

- Source:
- CPRect.scala

Tests whether this rectangle contains given rectangle horizontally.

Tests whether this rectangle contains given rectangle horizontally.

- Value parameters:
- rect
Rectangle to test.

- Source:
- CPRect.scala

Tests whether this rectangle contains given rectangle vertically.

Tests whether this rectangle contains given rectangle vertically.

- Value parameters:
- rect
Rectangle to test.

- Source:
- CPRect.scala

Tests whether this rectangle has at least one points satisfying given predicate.

Tests whether this rectangle has at least one points satisfying given predicate.

- Value parameters:
- f
Predicate to test.

- Source:
- CPRect.scala

Creates new rectangle grown in size enough to contain a given point. This method always creates new rectangle and its dimension will always be equal or larger than the dimension of this rectangle.

Creates new rectangle grown in size enough to contain a given point. This method always creates new rectangle and its dimension will always be equal or larger than the dimension of this rectangle.

- Value parameters:
- x2
X-coordinate of the point.

- y2
Y-coordinate of the point.

- Source:
- CPRect.scala

Creates intersection rectangle between this rectangle and a given one. If rectangles don't intersect, CPRect.ZERO is returned.

Creates intersection rectangle between this rectangle and a given one. If rectangles don't intersect, CPRect.ZERO is returned.

- Value parameters:
- rect
Rectangle to intersect with.

- Source:
- CPRect.scala

Tests whether this rectangle is position above of the given rectangle.

Tests whether this rectangle is position above of the given rectangle.

- Value parameters:
- r
Rectangle to test.

- Source:
- CPRect.scala

Tests whether this rectangle is position below of the given rectangle.

Tests whether this rectangle is position below of the given rectangle.

- Value parameters:
- r
Rectangle to test.

- Source:
- CPRect.scala

Tests whether this rectangle is position to the left of the given rectangle.

Tests whether this rectangle is position to the left of the given rectangle.

- Value parameters:
- r
Rectangle to test.

- Source:
- CPRect.scala

Tests whether this rectangle is position to the right of the given rectangle.

Tests whether this rectangle is position to the right of the given rectangle.

- Value parameters:
- r
Rectangle to test.

- Source:
- CPRect.scala

Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be horizontal first. In other words, given the rectangle with the following coordinates:

Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be horizontal first. In other words, given the rectangle with the following coordinates:

```
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
```

this method will iterate in the following order:

```
(0,0) (1,0) (2,0) (0,1) (1,1) (2,1) (0,2) (1,2) (2,2)
```

- Value parameters:
- f
XY-coordinate function to call.

- See also:
- Source:
- CPRect.scala

Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be horizontal first. In other words, given the rectangle with the following coordinates:

```
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
```

this method will iterate in the following order:

```
(0,0) (1,0) (2,0) (0,1) (1,1) (2,1) (0,2) (1,2) (2,2)
```

- Value parameters:
- f
XY-coordinate function to call.

- See also:
- Source:
- CPRect.scala

Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be vertical first. In other words, given the rectangle with the following coordinates:

Calls given XY-coordinate function on each point in this rectangle. Iteration over the points in this rectangle will be vertical first. In other words, given the rectangle with the following coordinates:

```
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
```

this method will iterate in the following order:

```
(0,0) (0,1) (0,2) (1,0) (1,1) (1,2) (2,0) (2,1) (2,2)
```

- Value parameters:
- f
XY-coordinate function to call.

- See also:
- Source:
- CPRect.scala

Tests whether or not this rectangle overlaps with the given one. Note that "touching" rectangles do not intersect as far as this method is concerned.

Tests whether or not this rectangle overlaps with the given one. Note that "touching" rectangles do not intersect as far as this method is concerned.

- Value parameters:
- rect
Rectangle to test.

- Source:
- CPRect.scala

Gets random X-coordinate within this rectangle.

Gets random X-coordinate within this rectangle.

- Source:
- CPRect.scala

Gets random XY-coordinate within this rectangle.

Gets random XY-coordinate within this rectangle.

- Source:
- CPRect.scala

Gets random Y-coordinate within this rectangle.

Gets random Y-coordinate within this rectangle.

- Source:
- CPRect.scala

Creates new rectangle with a minimal size to contain both this and given rectangle.

Creates new rectangle with a minimal size to contain both this and given rectangle.

- Value parameters:
- rect
Rectangle to combine with this rectangle.

- Source:
- CPRect.scala

### Inherited methods

Multiplies given value with each member of this tuple.

Multiplies given value with each member of this tuple.

- Value parameters:
- x
Value to multiple by.

- Returns:
New tuple as a result of multiplication.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Multiple two tuples by multiplying their corresponding values.

Multiple two tuples by multiplying their corresponding values.

- Value parameters:
- x
Other tuple to multiply with.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Adds given value to each member of this tuple.

Adds given value to each member of this tuple.

- Value parameters:
- x
Value to add.

- Returns:
New tuple as a result of addition.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Adds two tuples by adding their corresponding values.

Adds two tuples by adding their corresponding values.

- Value parameters:
- x
Tuple to add.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Subtracts given value from each member of this tuple.

Subtracts given value from each member of this tuple.

- Value parameters:
- x
Value to subtract.

- Returns:
New tuple as a result of subtraction.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Subtracts given tuple from this one by subtracting their corresponding values.

Subtracts given tuple from this one by subtracting their corresponding values.

- Value parameters:
- x
Tuple to subtract.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Divides each member of this tuple by the given value.

Divides each member of this tuple by the given value.

- Value parameters:
- x
Value to divide by.

- Returns:
New tuple as a result of division.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Device this tuple by the given tuple by dividing their corresponding values.

Device this tuple by the given tuple by dividing their corresponding values.

- Value parameters:
- x
Other tuple to divide by.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Less-then '<' operator for `int`

.

Less-then '<' operator for `int`

.

- Value parameters:
- x
Other tuple to compare.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Less-then '<' operator for tuples.

Less-then '<' operator for tuples.

- Value parameters:
- x
Other tuple to compare.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Less-then-or-equal '<=' operator for tuples.

Less-then-or-equal '<=' operator for tuples.

- Value parameters:
- x
Other tuple to compare.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Less-then-or-equal '<=' operator for `int`

.

Less-then-or-equal '<=' operator for `int`

.

- Value parameters:
- x
Other tuple to compare.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Greater-then '>' operator for tuples.

Greater-then '>' operator for tuples.

- Value parameters:
- x
Other tuple to compare.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Greater-then '>' operator for `int`

.

Greater-then '>' operator for `int`

.

- Value parameters:
- x
Other tuple to compare.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Greater-then-or-equal '>=' operator for tuples.

Greater-then-or-equal '>=' operator for tuples.

- Value parameters:
- x
Other tuple to compare.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Greater-then-or-equal '>=' operator for `int`

.

Greater-then-or-equal '>=' operator for `int`

.

- Value parameters:
- x
Other tuple to compare.

- Note:
Tuples must have the same arity.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Creates a copy of this tuple.

Creates a copy of this tuple.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Tests whether all values in this tuple are one.

Tests whether all values in this tuple are one.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Checks if this tuple contains only positive (> 0) numbers.

Checks if this tuple contains only positive (> 0) numbers.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Checks if this tuple contains only whole (>= 0) numbers.

Checks if this tuple contains only whole (>= 0) numbers.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Tests whether all values in this tuple are zero.

Tests whether all values in this tuple are zero.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

Maps this tuple using given function.

Maps this tuple using given function.

- Value parameters:
- f
Mapping function.

- Inherited from:
- CPIntTuple (hidden)
- Source:
- CPIntTuple.scala

### Concrete fields

Area of this rectangle as `width * height`

.

Area of this rectangle as `width * height`

.

- Source:
- CPRect.scala

X-coordinate of the center point as a float.

X-coordinate of the center point as a float.

- Source:
- CPRect.scala

Y-coordinate of the center point as a float.

Y-coordinate of the center point as a float.

- Source:
- CPRect.scala

Height of the rectangular (shortcut API).

Height of the rectangular (shortcut API).

- Source:
- CPRect.scala

Height of the rectangular (shortcut API) as a float.

Height of the rectangular (shortcut API) as a float.

- Source:
- CPRect.scala

Whether width and height are greater than zero.

Whether width and height are greater than zero.

- Source:
- CPRect.scala

Width of the rectangular (shortcut API).

Width of the rectangular (shortcut API).

- Source:
- CPRect.scala

Width of the rectangular (shortcut API) as a float.

Width of the rectangular (shortcut API) as a float.

- Source:
- CPRect.scala

Maximum X-coordinate. If width is zero this will equal to `x - 1`

.

Maximum X-coordinate. If width is zero this will equal to `x - 1`

.

- Source:
- CPRect.scala

Maximum X-coordinate as a float. If width is zero this will equal to `x - 1`

.

Maximum X-coordinate as a float. If width is zero this will equal to `x - 1`

.

- Source:
- CPRect.scala

Minimal X-coordinate as a float. It is equal to `x`

.

Minimal X-coordinate as a float. It is equal to `x`

.

- Source:
- CPRect.scala

Maximum Y-coordinate. If height is zero this will equal to `y - 1`

.

Maximum Y-coordinate. If height is zero this will equal to `y - 1`

.

- Source:
- CPRect.scala

Maximum Y-coordinate as a float. If height is zero this will equal to `y - 1`

.

Maximum Y-coordinate as a float. If height is zero this will equal to `y - 1`

.

- Source:
- CPRect.scala

Minimal Y-coordinate as a float. It is equal to `y`

.

Minimal Y-coordinate as a float. It is equal to `y`

.

- Source:
- CPRect.scala