https://github.com/fogleman/poissondisc
Poisson Disc sampling in Go.
https://github.com/fogleman/poissondisc
go golang poisson-disc-sampling
Last synced: 5 months ago
JSON representation
Poisson Disc sampling in Go.
- Host: GitHub
- URL: https://github.com/fogleman/poissondisc
- Owner: fogleman
- License: mit
- Created: 2018-08-31T01:29:02.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-23T20:12:24.000Z (about 6 years ago)
- Last Synced: 2025-04-01T20:25:32.763Z (7 months ago)
- Topics: go, golang, poisson-disc-sampling
- Language: Go
- Size: 5.86 KB
- Stars: 16
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## poissondisc
Poisson Disc sampling in Go.
### Installation
$ go get -u github.com/fogleman/poissondisc
### Documentation
https://godoc.org/github.com/fogleman/poissondisc
Learn more about Poisson-disc sampling:
https://www.jasondavies.com/poisson-disc/
https://bl.ocks.org/mbostock/dbb02448b0f93e4c82c3
### Usage
```go
var x0, y0, x1, y1, r float64
x0 = 0 // bbox min
y0 = 0 // bbox min
x1 = 1000 // bbox max
y1 = 1000 // bbox max
r = 10 // min distance between points
k := 30 // max attempts to add neighboring pointpoints := poissondisc.Sample(x0, y0, x1, y1, r, k, nil)
for _, p := range points {
fmt.Println(p.X, p.Y)
}
```### Example
$ go run examples/example.go
