From 938507d02d647aa383a465c08b7fe7dd51a2e3a3 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sun, 19 Jun 2022 11:47:54 +0800 Subject: [PATCH] move to pp --- README.md | 9 +++++++-- .../{lib3x-rands_disk-1.JPG => lib3x-pp_disk-1.JPG} | Bin ...b3x-rands_sphere-1.JPG => lib3x-pp_sphere-1.JPG} | Bin docs/{lib3x-rands_disk.md => lib3x-pp_disk.md} | 8 ++++---- docs/{lib3x-rands_sphere.md => lib3x-pp_sphere.md} | 8 ++++---- examples/voronoi/voronoi_melon.scad | 4 ++-- examples/voronoi/voronoi_sphere.scad | 4 ++-- src/experimental/note.md | 3 ++- src/{util/rands_disk.scad => pp/pp_disk.scad} | 6 +++--- src/{util/rands_sphere.scad => pp/pp_sphere.scad} | 8 ++++---- 10 files changed, 28 insertions(+), 22 deletions(-) rename docs/images/{lib3x-rands_disk-1.JPG => lib3x-pp_disk-1.JPG} (100%) rename docs/images/{lib3x-rands_sphere-1.JPG => lib3x-pp_sphere-1.JPG} (100%) rename docs/{lib3x-rands_disk.md => lib3x-pp_disk.md} (75%) rename docs/{lib3x-rands_sphere.md => lib3x-pp_sphere.md} (75%) rename src/{util/rands_disk.scad => pp/pp_disk.scad} (73%) rename src/{util/rands_sphere.scad => pp/pp_sphere.scad} (73%) diff --git a/README.md b/README.md index 949c761f..1938bdf7 100644 --- a/README.md +++ b/README.md @@ -397,8 +397,13 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp [**util/contains**(lt, elem)](https://openhome.cc/eGossip/OpenSCAD/lib3x-contains.html) | return `true` if `lt` contains `elem`. [**util/binary_search**(sorted, target[, lo, hi])](https://openhome.cc/eGossip/OpenSCAD/lib3x-binary_search.html) | search a value in a sorted list. [**util/count**(lt, test)](https://openhome.cc/eGossip/OpenSCAD/lib3x-count.html) | return the number of times `test` return `true` in the list. -[**util/rands_disk**(radius, value_count[, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-rands_disk.html) | generate random points over a disk. -[**util/rands_sphere**(radius, value_count[, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-rands_sphere.html) | pick random points on the surface of a sphere. + +## Point Picking + + Signature | Description +--|-- +[**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. ## Maze diff --git a/docs/images/lib3x-rands_disk-1.JPG b/docs/images/lib3x-pp_disk-1.JPG similarity index 100% rename from docs/images/lib3x-rands_disk-1.JPG rename to docs/images/lib3x-pp_disk-1.JPG diff --git a/docs/images/lib3x-rands_sphere-1.JPG b/docs/images/lib3x-pp_sphere-1.JPG similarity index 100% rename from docs/images/lib3x-rands_sphere-1.JPG rename to docs/images/lib3x-pp_sphere-1.JPG diff --git a/docs/lib3x-rands_disk.md b/docs/lib3x-pp_disk.md similarity index 75% rename from docs/lib3x-rands_disk.md rename to docs/lib3x-pp_disk.md index ad54d104..740c2508 100644 --- a/docs/lib3x-rands_disk.md +++ b/docs/lib3x-pp_disk.md @@ -1,4 +1,4 @@ -# rands_disk +# pp_disk Generate random points over a disk. @@ -12,16 +12,16 @@ Generate random points over a disk. ## Examples - use + use number = 10000; radius = 2; - points = rands_disk(radius, number); + points = pp_disk(radius, number); for(p = points) { translate(p) circle(.01); } -![rands_disk](images/lib3x-rands_disk-1.JPG) \ No newline at end of file +![rands_disk](images/lib3x-pp_disk-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-rands_sphere.md b/docs/lib3x-pp_sphere.md similarity index 75% rename from docs/lib3x-rands_sphere.md rename to docs/lib3x-pp_sphere.md index 5fcda37e..255d3326 100644 --- a/docs/lib3x-rands_sphere.md +++ b/docs/lib3x-pp_sphere.md @@ -1,4 +1,4 @@ -# rands_sphere +# pp_sphere Pick random points on the surface of a sphere. @@ -12,12 +12,12 @@ Pick random points on the surface of a sphere. ## Examples - use + use number = 1000; radius = 2; - points = rands_sphere(radius, number); + points = pp_sphere(radius, number); for(p = points) { @@ -27,4 +27,4 @@ Pick random points on the surface of a sphere. %sphere(radius, $fn = 48); -![rands_sphere](images/lib3x-rands_sphere-1.JPG) \ No newline at end of file +![rands_sphere](images/lib3x-pp_sphere-1.JPG) \ No newline at end of file diff --git a/examples/voronoi/voronoi_melon.scad b/examples/voronoi/voronoi_melon.scad index 77d17ac1..adf06d57 100644 --- a/examples/voronoi/voronoi_melon.scad +++ b/examples/voronoi/voronoi_melon.scad @@ -1,6 +1,6 @@ use use -use +use use eyelets = 800; @@ -9,7 +9,7 @@ radius = 50; voronoi_melon(eyelets, radius); module voronoi_melon(eyelets, radius) { - pts = rands_sphere(radius, eyelets); + pts = pp_sphere(radius, eyelets); cells = vrn_sphere(pts); color("DarkKhaki") diff --git a/examples/voronoi/voronoi_sphere.scad b/examples/voronoi/voronoi_sphere.scad index b25044dd..f310c4c6 100644 --- a/examples/voronoi/voronoi_sphere.scad +++ b/examples/voronoi/voronoi_sphere.scad @@ -3,13 +3,13 @@ use use use use -use +use n = 60; radius = 5; // pts = fibonacci_lattice(n, radius); -pts = rands_sphere(radius, n); +pts = pp_sphere(radius, n); region_hollow = true; region_offset = 0.2; diff --git a/src/experimental/note.md b/src/experimental/note.md index 34a9ce4a..b6dfada8 100644 --- a/src/experimental/note.md +++ b/src/experimental/note.md @@ -29,7 +29,8 @@ new: doc-ed deprecated: - - util/sort, util/bsearch, util/has, util/rands_disk, util/rands_sphere + - util/sort, util/bsearch, util/has + - pp/pp_disk, pp/pp_sphere - maze/mz_square_cells, maze/mz_theta_cells, maze/mz_square_walls, maze/mz_hex_walls - rails2sections diff --git a/src/util/rands_disk.scad b/src/pp/pp_disk.scad similarity index 73% rename from src/util/rands_disk.scad rename to src/pp/pp_disk.scad index dbd387c8..8bc65ea8 100644 --- a/src/util/rands_disk.scad +++ b/src/pp/pp_disk.scad @@ -1,14 +1,14 @@ /** -* rands_disk.scad +* pp_disk.scad * * @copyright Justin Lin, 2022 * @license https://opensource.org/licenses/lgpl-3.0.html * -* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-rands_disk.html +* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_disk.html * **/ -function rands_disk(radius, value_count, seed = undef) = +function pp_disk(radius, value_count, seed = undef) = let( seed_undef = is_undef(seed), n = value_count * 2, diff --git a/src/util/rands_sphere.scad b/src/pp/pp_sphere.scad similarity index 73% rename from src/util/rands_sphere.scad rename to src/pp/pp_sphere.scad index 6bb4f51c..ebe0c470 100644 --- a/src/util/rands_sphere.scad +++ b/src/pp/pp_sphere.scad @@ -1,16 +1,16 @@ /** -* rands_sphere.scad +* pp_sphere.scad * * @copyright Justin Lin, 2022 * @license https://opensource.org/licenses/lgpl-3.0.html * -* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-rands_sphere.html +* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_sphere.html * **/ -use +use <../util/degrees.scad> -function rands_sphere(radius, value_count, seed = undef) = +function pp_sphere(radius, value_count, seed = undef) = let(r_nums = is_undef(seed) ? rands(0, 1, value_count * 2) : rands(0, 1, value_count * 2, seed)) [ for(i = [0:value_count - 1])