0.15.0 • Published 5 years ago

infinite-poisson-disc-sampler v0.15.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Travis Badge

A poisson disc sampler implementation.

Example Codepen

Classes

MultiSampler

A poisson sampler that is a grid of samplers (this allows infinite worlds to use this).

Kind: global class

new MultiSampler(config)

Create a multisampler.

ParamTypeDefaultDescription
configObjectThe config for the sampler.
config.wNumber64The width of the entire sample space.
config.hNumber64The height of the entire sample space.
config.cwNumber32The width of each sub sampler.
config.chNumber32The height of each subsampler.
config.rNumber10The minimum radius between samples.

multiSampler.getPoints() ⇒ Array

Get all points from all sub-samplers.

Kind: instance method of MultiSampler
Returns: Array - The array of points.

multiSampler.getNewPoints() ⇒ Array

Get new sample points from sampler.

Kind: instance method of MultiSampler
Returns: Array - An array of points.

multiSampler.getPointsForCell(x, y) ⇒ Array

Get points for a single cell.

Kind: instance method of MultiSampler
Returns: Array - The array of points.

ParamTypeDescription
xNumberThe x coord in the cell.
yNumberThe y coord in the cell.

multiSampler.resize(h, w)

Resize the multisampler.

Kind: instance method of MultiSampler

ParamTypeDescription
hNumberNew height.
wNumberNew width.

multiSampler.prePopulate(points)

Prepopulates all the sub-samplers with the given points, rejecting ones outside the subsamplers.

Kind: instance method of MultiSampler

ParamTypeDescription
pointsArrayThe points to seed subsamplers with.

multiSampler.remove(x, y)

Remove a sample from the grid. It will be replaced with new one the next time get points is called.

Kind: instance method of MultiSampler

ParamTypeDescription
xNumberThe x coord.
yNumberThe y coord.

RandomSampler

A fast poison disc sampler. Based on https://www.jasondavies.com/poisson-disc/

Kind: global class

new RandomSampler(config)

constructor

ParamTypeDefaultDescription
configObjectThe config for the sampler.
config.wNumber64The width of the sample space.
config.hNumber64The height of the sample space.
config.xNumber0The offset from "world" center (used by multisampler).
config.yNumber0The offset from world center.
config.rNumber10The minimum radius between points.

randomSampler.getPoints() ⇒ Array

Get all sample points from sampler.

Kind: instance method of RandomSampler
Returns: Array - An array of points.

randomSampler.getNewPoints(The) ⇒ Array

Get new sample points from sampler.

Kind: instance method of RandomSampler
Returns: Array - An array of points.

ParamTypeDescription
TheNumbernumber of new points desired.

randomSampler.run()

Runs the sampler.

Kind: instance method of RandomSampler

randomSampler.remove(x, y)

Remove a sample from the grid. It will be replaced with new one the next time get points is called.

Kind: instance method of RandomSampler

ParamTypeDescription
xNumberThe x coord.
yNumberThe y coord.

randomSampler.prePopulate(points)

Pre-populate the sampler with points.

Kind: instance method of RandomSampler

ParamTypeDescription
pointsArrayThe points to add to the sampler.

PoissonDiscSampler

A fast poison disc sampler. Based on https://www.jasondavies.com/poisson-disc/

Kind: global class

new PoissonDiscSampler(config)

constructor

ParamTypeDefaultDescription
configObjectThe config for the sampler.
config.wNumber64The width of the sample space.
config.hNumber64The height of the sample space.
config.xNumber0The offset from "world" center (used by multisampler).
config.yNumber0The offset from world center.
config.rNumber10The minimum radius between points.

poissonDiscSampler.getPoints() ⇒ Array

Get all sample points from sampler.

Kind: instance method of PoissonDiscSampler
Returns: Array - An array of points.

poissonDiscSampler.getNewPoints(The) ⇒ Array

Get new sample points from sampler.

Kind: instance method of PoissonDiscSampler
Returns: Array - An array of points.

ParamTypeDescription
TheNumbernumber of new points desired.

poissonDiscSampler.run()

Runs the sampler.

Kind: instance method of PoissonDiscSampler

poissonDiscSampler.remove(x, y)

Remove a sample from the grid. It will be replaced with new one the next time get points is called.

Kind: instance method of PoissonDiscSampler

ParamTypeDescription
xNumberThe x coord.
yNumberThe y coord.

poissonDiscSampler.prePopulate(points)

Pre-populate the sampler with points.

Kind: instance method of PoissonDiscSampler

ParamTypeDescription
pointsArrayThe points to add to the sampler.
0.15.0

5 years ago

0.14.0

5 years ago

0.13.4

5 years ago

0.13.3

6 years ago

0.13.2

6 years ago

0.13.1

6 years ago

0.12.0

6 years ago

0.11.0

6 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago