RegularPolygon

RegularPolygon[n]

gives the regular polygon with n vertices equally spaced around the unit circle.

RegularPolygon[r,n]

gives the regular polygon of radius r.

RegularPolygon[{r,θ},n]

starts at angle θ with respect to the axis.

RegularPolygon[{x,y},rspec,n]

centers the polygon at {x,y}.

Details

Examples

open allclose all

Basic Examples  (3)

A pentagon:

Different styles applied to RegularPolygon:

Area and centroid:

Scope  (17)

Graphics  (7)

Specification  (4)

Generate an equilateral triangle, square, pentagon, hexagon, etc.:

Generate pentagons of varying radii:

Generate triangles of varying starting angles:

Place six hexagons equally spaced around the unit circle:

Styling  (2)

Color directives specify the face colors of regular polygons:

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

Coordinate  (1)

Use Dynamic coordinates:

And dynamic radii:

Regions  (10)

Embedding dimension:

Geometric dimension:

Point membership test:

Get conditions for point membership:

Area:

Centroid:

Distance from a point:

The distance to the nearest point in the unit disk:

Signed distance from a point:

Signed distance to the unit disk:

Nearest point in the region:

Nearest points:

A regular polygon is bounded:

Get its range:

Integrate over a hexagon:

Optimize over a hexagon:

Solve equations in a hexagon:

Applications  (4)

Create a star region by taking the RegionUnion of rotated triangles about a common origin:

Create 3D extrusions with RegionProduct:

Plot a function over a hexagon:

Some lattices will have regular polygons as their cells. Consider the lattice basis:

Generate lattice points and tiles:

Visualize the tiling and lattice points:

Properties & Relations  (3)

A RegularPolygon is a Polygon whose vertices are equally spaced around the unit circle:

Use CirclePoints to generate points equally spaced around the unit circle:

The area of a regular polygon on the unit circle as is the area of a unit Disk:

Neat Examples  (2)

A collection of random regular polygons:

Overlap regular polygons of increasing radii and vertices:

Introduced in 2015
 (10.2)
 |
Updated in 2019
 (12.0)