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

disc

Circular Window


Description

Creates a circular window

Usage

disc(radius=1, centre=c(0,0), ..., mask=FALSE, npoly=128, delta=NULL)

Arguments

radius

Radius of the circle.

centre

The centre of the circle.

mask

Logical flag controlling the type of approximation to a perfect circle. See Details.

npoly

Number of edges of the polygonal approximation, if mask=FALSE. Incompatible with delta.

delta

Tolerance of polygonal approximation: the length of arc that will be replaced by one edge of the polygon. Incompatible with npoly.

...

Arguments passed to as.mask determining the pixel resolution, if mask=TRUE.

Details

This command creates a window object representing a disc, with the given radius and centre.

By default, the circle is approximated by a polygon with npoly edges.

If mask=TRUE, then the disc is approximated by a binary pixel mask. The resolution of the mask is controlled by the arguments ... which are passed to as.mask.

The argument radius must be a single positive number. The argument centre specifies the disc centre: it can be either a numeric vector of length 2 giving the coordinates, or a list(x,y) giving the coordinates of exactly one point, or a point pattern (object of class "ppp") containing exactly one point.

Value

An object of class "owin" (see owin.object) specifying a window.

Note

This function can also be used to generate regular polygons, by setting npoly to a small integer value. For example npoly=5 generates a pentagon and npoly=13 a triskaidecagon.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

# unit disc
 W <- disc()
 # disc of radius 3 centred at x=10, y=5
 W <- disc(3, c(10,5))
 #
 plot(disc())
 plot(disc(mask=TRUE))
 # nice smooth circle
 plot(disc(npoly=256))
 # how to control the resolution of the mask
 plot(disc(mask=TRUE, dimyx=256))
 # check accuracy of approximation
 area(disc())/pi
 area(disc(mask=TRUE))/pi

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.