
npm install infinite-poisson-disc-samplerA poisson disc sampler implementation.
A poisson sampler that is a grid of samplers (this allows infinite worlds to use this).
A fast poison disc sampler.
Based on https://www.jasondavies.com/poisson-disc/
A fast poison disc sampler.
Based on https://www.jasondavies.com/poisson-disc/
Kind: global class
* MultiSampler
* new MultiSampler(config)
* .getPoints() ⇒ Array
* .getNewPoints() ⇒ Array
* .getPointsForCell(x, y) ⇒ Array
* .resize(h, w)
* .prePopulate(points)
* .remove(x, y)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| config | Object | | The config for the sampler. |
| [config.w] | Number | 64 | The width of the entire sample space. |
| [config.h] | Number | 64 | The height of the entire sample space. |
| [config.cw] | Number | 32 | The width of each sub sampler. |
| [config.ch] | Number | 32 | The height of each subsampler. |
| [config.r] | Number | 10 | The minimum radius between samples. |
Kind: instance method of MultiSampler
Returns: Array - The array of points.
Kind: instance method of MultiSampler
Returns: Array - An array of points.
Kind: instance method of MultiSampler
Returns: Array - The array of points.
| Param | Type | Description |
| --- | --- | --- |
| x | Number | The x coord in the cell. |
| y | Number | The y coord in the cell. |
Kind: instance method of MultiSampler
| Param | Type | Description |
| --- | --- | --- |
| h | Number | New height. |
| w | Number | New width. |
Kind: instance method of MultiSampler
| Param | Type | Description |
| --- | --- | --- |
| points | Array | The points to seed subsamplers with. |
Kind: instance method of MultiSampler
| Param | Type | Description |
| --- | --- | --- |
| x | Number | The x coord. |
| y | Number | The y coord. |
Kind: global class
* RandomSampler
* new RandomSampler(config)
* .getPoints() ⇒ Array
* .getNewPoints(The) ⇒ Array
* .run()
* .remove(x, y)
* .prePopulate(points)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| config | Object | | The config for the sampler. |
| [config.w] | Number | 64 | The width of the sample space. |
| [config.h] | Number | 64 | The height of the sample space. |
| [config.x] | Number | 0 | The offset from "world" center (used by multisampler). |
| [config.y] | Number | 0 | The offset from world center. |
| [config.r] | Number | 10 | The minimum radius between points. |
Kind: instance method of RandomSampler
Returns: Array - An array of points.
Kind: instance method of RandomSampler
Returns: Array - An array of points.
| Param | Type | Description |
| --- | --- | --- |
| The | Number | number of new points desired. |
Kind: instance method of RandomSampler
Kind: instance method of RandomSampler
| Param | Type | Description |
| --- | --- | --- |
| x | Number | The x coord. |
| y | Number | The y coord. |
Kind: instance method of RandomSampler
| Param | Type | Description |
| --- | --- | --- |
| points | Array | The points to add to the sampler. |
Kind: global class
* PoissonDiscSampler
* new PoissonDiscSampler(config)
* .getPoints() ⇒ Array
* .getNewPoints(The) ⇒ Array
* .run()
* .remove(x, y)
* .prePopulate(points)
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| config | Object | | The config for the sampler. |
| [config.w] | Number | 64 | The width of the sample space. |
| [config.h] | Number | 64 | The height of the sample space. |
| [config.x] | Number | 0 | The offset from "world" center (used by multisampler). |
| [config.y] | Number | 0 | The offset from world center. |
| [config.r] | Number | 10 | The minimum radius between points. |
Kind: instance method of PoissonDiscSampler
Returns: Array - An array of points.
Kind: instance method of PoissonDiscSampler
Returns: Array - An array of points.
| Param | Type | Description |
| --- | --- | --- |
| The | Number | number of new points desired. |
Kind: instance method of PoissonDiscSampler
Kind: instance method of PoissonDiscSampler
| Param | Type | Description |
| --- | --- | --- |
| x | Number | The x coord. |
| y | Number | The y coord. |
Kind: instance method of PoissonDiscSampler
| Param | Type | Description |
| --- | --- | --- |
| points | Array | The points to add to the sampler. |