These functions generate uniform samples from a disk in 2-dimensional space, optionally with noise.
sample_disk(n, bins = 1L, sd = 0)
n | Number of observations. |
---|---|
bins | Number of intervals per dimension to stratify by. Default set to 1, which generates a uniform sample. |
sd | Standard deviation of (independent multivariate) Gaussian noise. |
The sample is generated by an area-preserving parameterization of the disk. This parametrization was derived through the method for sampling 2-manifolds as described by Arvo (2001).
J Arvo (2001) Stratified Sampling of 2-Manifolds. SIGRAPH 2001 (State of the Art in Monte Carlo Ray Tracing for Realistic Image Synthesis), Course Notes, Vol. 29. https://www.cs.princeton.edu/courses/archive/fall04/cos526/papers/course29sig01.pdf
set.seed(99812L) # Uniformly sampled unit disk in 2-space x <- sample_disk(1800, sd = 0) plot(x, asp = 1, pch = 19, cex = .5)# Uniformly sampled unit disk in 2-space with Gaussian noise x <- sample_disk(1800, sd = .1) plot(x, asp = 1, pch = 19, cex = .5)