diff --git a/README.md b/README.md index 1938bdf7..e61add30 100644 --- a/README.md +++ b/README.md @@ -404,6 +404,9 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp --|-- [**pp/pp_disk**(radius, value_count[, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_disk.html) | generate random points over a disk. [**pp/pp_sphere**(radius, value_count[, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_sphere.html) | pick random points on the surface of a sphere. +[**pp/pp_poisson2**(size, r[, start, k, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_poisson2.html) | perform poisson sampling over a rectangle area. + +[**pp/pp_poisson3**(size, r[, start, k, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_poisson3.html) | perform poisson sampling over a cube space. ## Maze diff --git a/docs/images/lib3x-pp_poisson2-1.JPG b/docs/images/lib3x-pp_poisson2-1.JPG new file mode 100644 index 00000000..78ccaabc Binary files /dev/null and b/docs/images/lib3x-pp_poisson2-1.JPG differ diff --git a/docs/images/lib3x-pp_poisson3-1.JPG b/docs/images/lib3x-pp_poisson3-1.JPG new file mode 100644 index 00000000..cec9d188 Binary files /dev/null and b/docs/images/lib3x-pp_poisson3-1.JPG differ diff --git a/docs/lib3x-pp_poisson2.md b/docs/lib3x-pp_poisson2.md new file mode 100644 index 00000000..90844636 --- /dev/null +++ b/docs/lib3x-pp_poisson2.md @@ -0,0 +1,26 @@ +# pp_poisson2 + +Perform poisson sampling over a rectangle area. An implementation of [Fast Poisson Disk Sampling in Arbitrary Dimensions](https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf). + +**Since:** 3.3 + +## Parameters + +- `size` : The size `[x, y]` of the rectangle. +- `r` : The minimum distance between samples. +- `start` : Optional. The first start point. +- `k` : Default to 30. The `k` constant of [Fast Poisson Disk Sampling in Arbitrary Dimensions](https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf). +- `seed` : Optional. Seed value for random number generator for repeatable results. + +## Examples + + use + use + + points = pp_poisson2([100, 100], 5); + for(p = points) { + translate(p) + circle(1); + } + +![pp_poisson2](images/lib3x-pp_poisson2-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-pp_poisson3.md b/docs/lib3x-pp_poisson3.md new file mode 100644 index 00000000..27ad6e62 --- /dev/null +++ b/docs/lib3x-pp_poisson3.md @@ -0,0 +1,26 @@ +# pp_poisson3 + +Perform poisson sampling over a cube space. An 3D implementation of [Fast Poisson Disk Sampling in Arbitrary Dimensions](https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf). + +**Since:** 3.3 + +## Parameters + +- `size` : The size `[x, y]` of the rectangle. +- `r` : The minimum distance between samples. +- `start` : Optional. The first start point. +- `k` : Default to 30. The `k` constant of [Fast Poisson Disk Sampling in Arbitrary Dimensions](https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf). +- `seed` : Optional. Seed value for random number generator for repeatable results. + +## Examples + + use + use + + points = pp_poisson3([50, 50, 50], 10); + for(p = points) { + translate(p) + sphere(5, $fn = 48); + } + +![pp_poisson3](images/lib3x-pp_poisson3-1.JPG) \ No newline at end of file