runif.sph | R Documentation |
Generates uniformly distributed variables in the spherical volume segments defined by 'r', 'theta' and 'phi'.
runif.sph(
n,
r = c(0, 1),
theta = c(0, 2 * pi),
phi = c(0, pi),
sph.out = TRUE,
offset = list(),
scale.voxels = 1,
rand.gen = c("unif", "beta", "norm"),
reverse = FALSE
)
n |
is the number of positions to draw, given either as a single integer or as a vector where each element corresponds to a spherical segment given by the rows of 'r', 'theta' and 'phi'. |
r |
is range of radial coordinates, given as a vector of interval values (in which case length(r)-1 spherical segemnts are treated) or as a two column matrix where the first column represents the lower limit of the sperical segments, and the second column represents the upper limit. |
theta |
is the range of azimuth angles in radians, given in the same way as 'r'. |
phi |
is the range of elevation angles in radians, given in the same way as 'r'. |
offset |
is the angluar offset by which the input specifications 'r', 'theta' and 'phi' are rotated prior to application of runif.sph(). The result of runif.sph() is rotated back by the inverse angles. |
scale.voxels |
is a factor by which to enlarge the extent of each spherical element inside which points are drawn. If scale.voxels=2, the radial positions are drawn from -0.5 to 1.5 of the extent of the radial boundaries, so that point extend into the previous and next radial interval. The same applies to all three directions. |
rand.gen |
is either a string naming the random generating function to use when drawing positions inside the spherical segments, or a (symetrical) function. If rand.gen[1]=="beta", the symmetrical beta function is used (shape1=shape2=2). |
reverse |
is TRUE to reverse the rotation by reversing the order of 'by' and 'ang', and also multiplying 'ang' by -1. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.