Skip to content

struct DiskSampler2D

Kelvin edited this page Jun 11, 2017 · 3 revisions
Structure

DiskSampler2D

A point sampler capable of producing uniform and roughly-evenly spaced pseudo-random point distributions in the plane. Disk sampling is sometimes referred to as Poisson sampling.

Disk samples are not a noise field — its generation is inherently sequential, as opposed to most procedural noise fields which are embarrassingly parallel. Thus, disk samples have no concept of evaluation; the entire sample set must be generated as a whole.


Symbols

Initializers

init(seed:Int = 0)

Creates an instance with the given fixed random seed. This process calculates a random table used internally in the sample generation step. The same instance can be reused to generate multiple, different point distributions.

Instance methods

mutating func generate(radius:Double, width:Int, height:Int, k:Int = 32, seed:(Double, Double)? = nil) -> [(Double, Double)]

Generates a set of sample points that are spaced no less than radius apart over a region sized width by height . Up to k candidate points will be used to generate each sample point; higher values of k yield more compact point distributions, but take longer to run. The seed point specifies the first point that is added to the distribution, and influences where subsequent sample points are added. This seed is orthogonal to the seed supplied in the initializer. If seed is left nil, the seed point is placed at the center of the region.

API reference

1.0.0

Clone this wiki locally