Learn R Programming

spatstat.geom (version 3.2-5)

ellipse: Elliptical Window.

Description

Create an elliptical window.

Usage

ellipse(a, b, centre=c(0,0), phi=0, ..., mask=FALSE, npoly = 128)

Value

An object of class owin (either of type “polygonal”

or of type “mask”) specifying an elliptical window.

Arguments

a,b

The half-lengths of the axes of the ellipse.

centre

The centre of the ellipse.

phi

The (anti-clockwise) angle through which the ellipse should be rotated (about its centre) starting from an orientation in which the axis of half-length a is horizontal.

mask

Logical value controlling the type of approximation to a perfect ellipse. See Details.

...

Arguments passed to as.mask to determine the pixel resolution, if mask is TRUE.

npoly

The number of edges in the polygonal approximation to the ellipse.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz.

Details

This command creates a window object representing an ellipse with the given centre and axes.

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

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

The arguments a and b must be single positive numbers. The argument centre specifies the ellipse 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.

See Also

disc, owin.object, owin, as.mask

Examples

Run this code
  W <- ellipse(a=5,b=2,centre=c(5,1),phi=pi/6)
  plot(W,lwd=2,border="red")
  WM <- ellipse(a=5,b=2,centre=c(5,1),phi=pi/6,mask=TRUE,dimyx=64)
  plot(WM,add=TRUE,box=FALSE)

Run the code above in your browser using DataLab