eroded.areas.sphwin: Area of morphological erosions of a sphere or a subset of a...

View source: R/eroded.areas.sphwin.R

eroded.areas.sphwinR Documentation

Area of morphological erosions of a sphere or a subset of a sphere

Description

Computes the areas of successive morphological erosions of a window, where the window is a sphere or subset of a sphere.

Usage

  eroded.areas.sphwin(win = sphwin(type = "sphere"),
                      r=NULL, method = "exact", ...)

Arguments

win

The window.

r

Numeric vector of radii at which erosions will be performed. Must have length 512, and must be specified if win is of type quadrangle or polygon. If r=NULL and win is of type band or wedge, then the r will be generated such that r is between 0 and the smallest distance at which the area of the erosion is 0. If win is of type sphere, then r is arbitrary (see Details) but for consistency with other functions is a length 512 numeric with r between 0 and pi times the radius of the sphere.

method

(For spherical wedges only) specifies the method used to estimate/calculate the area morphological erosions of the window. Must be one of "exact", "integral" or "grid" (see Details).

...

(For spherical wedges where method="grid", and polygons only) Input to be passed to gridmat. See Details below, then gridmat, for more information.

Details

This function computes the areas of the erosions of the window w by each of the radii r[i].

The morphological erosion of a set W by a distance r > 0 is the subset consisting of all points x in W such that the distance from x to the boundary of W is greater than or equal to r. In other words it is the result of trimming a margin of width r off the set W.

The argument r should be a vector of nonnegative numbers. The argument w should be a window (an object of class "sphwin", see sphwin).

For the sphere, eroded.areas.sph returns a length 512 numeric where each value is the area of the sphere, since the erosions cannot exist because there are no boundaries on the sphere.

For the spherical wedge, it is recommended that the exact method of calculating the areas of the morphological erosions (method="exact") as it exactly calculates the areas and has the least computation time of the three methods.

Alternatively, there are two estimates of the morphological erosions of the spherical wedge. The first estimator is "integral", which involves estimating the integral formula for the morphological erosion:

integral[0, r] length(delta(W[-s])) ds

This is a relatively accurate estimator and has a similar computation time to the exact method.

The second estimator, which is also the estimator used for the spherical polygon, is "grid", which involves superimposing a grid of cells of equal area and angular width; for each r, the total number of cells for which the centre is >=r from the boundary of the wedge is found and the result multipled by the area of a single cell. This method is the slowest and generates a curve which is only smooth when the grid is sufficiently fine. This estimator requires further arguments to be sent to gridmat; for the spherical polygon, all arguments that gridmat needs are required i.e. colats, lons, ncolat, nlon. For the spherical wedge, only ncolat, nlon are required; eroded.areas.sph calculates the values of colats, lons.

Value

A vector containing the areas of morphological erosions of the sphere.

Note

This function is the analogue for point processes on the sphere of the function eroded.areas in spatstat, which is the corresponding function for point processes in R^2. Hence elements of this help page have been taken from eroded.areas with the permission of A. J Baddeley. This enables the information on this help page to be consistent with that for eroded.areas. It is hoped that this will minimise or remove any confusion for users of both spatstat and spherstat.

Author(s)

Tom Lawrence <email:tjlawrence@bigpond.com>

See Also

area.sphwin (area of a sphere or subset of a sphere), bdist.sphwin (minimum distance from each of one or more points to the boundary of a window).

Examples

sph <- sphwin(type="sphere")
eroded.areas.sphwin(win=sph, r=seq(0, pi, length=512))

sphwedge <- sphwin(type="wedge", param=c(pi/3, 0), ref=c(0,0))
eroded.areas.sphwin(win=sphwedge, r=seq(0, pi/6, length=512), method="exact")

baddstats/spherstat documentation built on Feb. 6, 2023, 1:45 a.m.