disks {tdaunif} | R Documentation |
Sample (with noise) from disk
Description
These functions generate uniform samples from a disk in 2-dimensional space, optionally with noise.
Usage
sample_disk(n, bins = 1L, sd = 0)
Arguments
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. |
Details
The sample is generated by an area-preserving parameterization of the disk. This parameterization was derived through the method for sampling 2-manifolds as described by Arvo (2001).
References
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
Examples
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)
[Package tdaunif version 0.1.1 Index]