1
0
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:
Justin Lin
2021-09-08 18:02:17 +08:00
parent cafa0ebd06
commit 8fb3d5b579

View 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);*/