spatstat (version 1.42-2)

grow.rectangle: Add margins to rectangle

Description

Adds a margin to a rectangle.

Usage

grow.rectangle(W, xmargin=0, ymargin=xmargin)

Arguments

W
A window (object of class "owin"). Must be of type "rectangle".
xmargin
Width of horizontal margin to be added. A single nonnegative number, or a vector of length 2 indicating margins of unequal width at left and right.
ymargin
Height of vertical margin to be added. A single nonnegative number, or a vector of length 2 indicating margins of unequal width at bottom and top.

Value

  • Another object of class "owin" representing the window after margins are added.

Details

This is a simple convenience function to add a margin of specified width and height on each side of a rectangular window. Unequal margins can also be added.

See Also

trim.rectangle, dilation, erosion, owin.object

Examples

Run this code
w <- square(10)
  # add a margin of width 1 on all four sides
  square11 <- grow.rectangle(w, 1)

  # add margin of width 3 on the right side
  # and margin of height 4 on top.
  v <- grow.rectangle(w, c(0,3), c(0,4))

Run the code above in your browser using DataCamp Workspace