Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

regularpolygon

Create A Regular Polygon


Description

Create a window object representing a regular (equal-sided) polygon.

Usage

regularpolygon(n, edge = 1, centre = c(0, 0), ...,
               align = c("bottom", "top", "left", "right", "no"))

hexagon(edge = 1, centre = c(0,0), ...,
        align = c("bottom", "top", "left", "right", "no"))

Arguments

n

Number of edges in the polygon.

edge

Length of each edge in the polygon. A single positive number.

centre

Coordinates of the centre of the polygon. A numeric vector of length 2, or a list(x,y) giving the coordinates of exactly one point, or a point pattern (object of class "ppp") containing exactly one point.

align

Character string specifying whether to align one of the edges with a vertical or horizontal boundary.

...

Ignored.

Details

The function regularpolygon creates a regular (equal-sided) polygon with n sides, centred at centre, with sides of equal length edge. The function hexagon is the special case n=6.

The orientation of the polygon is determined by the argument align. If align="no", one vertex of the polygon is placed on the x-axis. Otherwise, an edge of the polygon is aligned with one side of the frame, specified by the value of align.

Value

A window (object of class "owin").

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

hextess for hexagonal tessellations.

Examples

plot(hexagon())
  plot(regularpolygon(7))
  plot(regularpolygon(7, align="left"))

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.