runif_on_spherePatch {uniformly} | R Documentation |
Uniform sampling on a spherical patch
Description
Uniform sampling on a spherical patch (in dimension 3).
Usage
runif_on_spherePatch(n, r = 1, phi1, phi2, theta1, theta2)
Arguments
n |
number of simulations |
r |
radius |
phi1 , phi2 |
numbers defining the latitudinal angle range |
theta1 , theta2 |
numbers defining the longitudinal angle range |
Details
A sphere patch is the part of the sphere whose polar angles
theta
and phi
satisfy
0 <= theta1 <= theta <= theta2 <= 2*pi
and
0 <= phi1 <= phi <= phi2 <= pi
.
Value
The simulations in a n
times 3
matrix.
See Also
runif_on_stri
for sampling on a spherical triangle.
Examples
# sampling on the first orthant:
sims <-
runif_on_spherePatch(100, phi1 = 0, phi2 = pi/2, theta1 = 0, theta2 = pi/2)
## Not run:
library(rgl)
spheres3d(0, 0, 0, color = "red", alpha = 0.5)
points3d(sims)
## End(Not run)
[Package uniformly version 0.5.0 Index]