@rbxts/poisson-disk-sampling
v0.2.5
Published
Poisson disk sampling implemention for roblox-ts
Downloads
4
Readme
Poisson Disk Sampling for roblox-ts
This module provides an implementation of Bridson's algorithm for Poisson Disk Sampling, a technique for randomly generating points within a given region while ensuring that they are distributed with a minimum and maximum distance from each other.
Installation
You can install this module using npm:
npm install @rbxts/poisson-disk-sampling
For navigable documentation,
Usage
import { PoissonDiskSampler } from "@rbxts/poisson-disk-sampling";
function example() {
const sampler = new PoissonDiskSampler(
{ xMin: 0, xMax: 100, yMin: 0, yMax: 100 }, // region
5, // minDistance
5, // density (not yet implemented)
30 // maxAttempts
);
sampler.getPoints().forEach((point) => {
print(point.x, point.y);
});
}
Todo
- [x] An implementation of Bridson's algorithm
- [x] Enable configuration of the algorithm, such as max attempts to generate a new random point in an annulus around each active point.
- [ ] Various algorithm implementations, such as those that support variable density and parallelization.
- [ ] N-dimensional generation
- [x] Documentation