mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 14:04:53 +02:00
add rand_pts_circle
This commit is contained in:
25
src/experimental/rand_pts_circle.scad
Normal file
25
src/experimental/rand_pts_circle.scad
Normal file
@@ -0,0 +1,25 @@
|
||||
function rand_pts_circle(radius, value_count, seed = undef) =
|
||||
let(
|
||||
seed_undef = is_undef(seed),
|
||||
theta = seed_undef ? rands(0, 360, value_count * 2) : rands(0, 360, value_count * 2, seed),
|
||||
k = seed_undef ? rands(0, 1, value_count * 2) : rands(0, 1, value_count * 2, seed)
|
||||
|
||||
)
|
||||
[
|
||||
for(i = [0:value_count - 1])
|
||||
let(r = sqrt(k[i]) * radius)
|
||||
[cos(theta[i]), sin(theta[i])] * r
|
||||
];
|
||||
|
||||
/*
|
||||
number = 10000;
|
||||
radius = 2;
|
||||
|
||||
points = rand_pts_circle(radius, number);
|
||||
|
||||
for(p = points) {
|
||||
translate(p)
|
||||
circle(.01);
|
||||
}
|
||||
|
||||
%circle(radius, $fn = 96);*/
|
Reference in New Issue
Block a user