# Rectangle Rectangle[{xmin,ymin},{xmax,ymax}]

represents an axis-aligned filled rectangle from {xmin,ymin} to {xmax,ymax}.

Rectangle[{xmin,ymin}]

corresponds to a unit square with its bottom-left corner at {xmin,ymin}.

# Details and Options • Rectangle can be used as a geometric region and a graphics primitive.
• Rectangle represents the region .
• • is equivalent to Rectangle[{0,0}]. »
• CanonicalizePolygon can be used to convert a rectangle to an explicit Polygon object.
• Rectangle can be used in Graphics.
• In graphics, the points {xi,yi} can be Scaled, Offset, ImageScaled, and Dynamic expressions.
• The option can be used to specify rounded corners rendered using circles of radius r.
• Graphics rendering is affected by directives such as FaceForm, EdgeForm and color.

# Examples

open allclose all

## Basic Examples(5)

A unit square:

Two squares:

Various rectangles:

Differently styled rectangles:

Area and centroid:

## Scope(17)

### Graphics(7)

#### Specification(3)

A unit square:

A rectangle parallel to each axis:

Short form for a unit cube with corner at the origin:

#### Styling(1)

Color directives specify the face colors of rectangles:

FaceForm and EdgeForm can be used to specify the styles of the interior and boundary of a rectangle:

#### Coordinates(3)

Use Scaled coordinates:

Use ImageScaled coordinates:

Use Offset coordinates:

### Regions(10)

Embedding dimension:

Geometric dimension:

Point membership test:

Get conditions for point membership:

Area:

Centroid:

Distance from a point:

Plot it:

Signed distance from a point:

Plot it:

Nearest point in the region:

Nearest points:

A rectangle is bounded:

Get its bounds:

Integrate over a rectangle:

Optimize over a rectangle:

Solve equations in a rectangle:

## Options(1)

Use rounded corners:

## Applications(6)

A simple bar chart:

Golden rectangle:

Square wheel:

The trajectory of the square wheel:

A Rectangle with equal side lengths is a square:

Visualize it:

Maximize the area of a rectangle with a fixed perimeter:

The resulting rectangle is a square:

Indeed, it will always be a square:

## Properties & Relations(9)

Use Rotate to get all possible rectangles:

Rectangle is a special case of Cuboid:

Rectangle is a special case of Parallelogram:

Rectangle is a special case of Polygon:

Rectangle is the union of two Triangle objects:

ImplicitRegion can represent any Rectangle region:

ParametricRegion can represent any Rectangle region:

MeshRegion can represent any Rectangle region:

BoundaryMeshRegion can represent any Rectangle region: