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

hextess

Hexagonal Grid or Tessellation


Description

Construct a hexagonal grid of points, or a hexagonal tessellation.

Usage

hexgrid(W, s, offset = c(0, 0), origin=NULL, trim = TRUE)

hextess(W, s, offset = c(0, 0), origin=NULL, trim = TRUE)

Arguments

W

Window in which to construct the hexagonal grid or tessellation. An object of class "owin".

s

Side length of hexagons. A positive number.

offset

Numeric vector of length 2 specifying a shift of the hexagonal grid. See Details.

origin

Numeric vector of length 2 specifying the initial origin of the hexagonal grid, before the offset is applied. See Details.

trim

Logical value indicating whether to restrict the result to the window W. See Details.

Details

hexgrid constructs a hexagonal grid of points on the window W. If trim=TRUE (the default), the grid is intersected with W so that all points lie inside W. If trim=FALSE, then we retain all grid points which are the centres of hexagons that intersect W.

hextess constructs a tessellation of hexagons on the window W. If trim=TRUE (the default), the tessellation is restricted to the interior of W, so that there will be some fragmentary hexagons near the boundary of W. If trim=FALSE, the tessellation consists of all hexagons which intersect W.

The points of hexgrid(...) are the centres of the tiles of hextess(...) in the same order.

In the initial position of the grid or tessellation, one of the grid points (tile centres) is placed at the origin, which defaults to the midpoint of the bounding rectangle of W. The grid can be shifted relative to this origin by specifing the offset.

Value

The value of hexgrid is a point pattern (object of class "ppp").

The value of hextess is a tessellation (object of class "tess").

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

Examples

if(interactive()) {
    W <- Window(chorley)
    s <- 0.7
  } else {
    W <- letterR
    s <- 0.3
  }
  plot(hextess(W, s))
  plot(hexgrid(W, s), add=TRUE)

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.