mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-18 04:21:16 +02:00
refactor: vt multi
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
function rands_disk(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)
|
||||
|
||||
n = value_count * 2,
|
||||
theta = seed_undef ? rands(0, 360, n) : rands(0, 360, n, seed),
|
||||
k = radius ^ 2 * (seed_undef ? rands(0, 1, n) : rands(0, 1, n, seed))
|
||||
)
|
||||
[
|
||||
for(i = [0:value_count - 1])
|
||||
let(r = sqrt(k[i]) * radius)
|
||||
[cos(theta[i]), sin(theta[i])] * r
|
||||
[cos(theta[i]), sin(theta[i])] * sqrt(k[i])
|
||||
];
|
||||
|
||||
/*
|
||||
use <util/rands_disk.scad>;
|
||||
|
||||
number = 10000;
|
||||
radius = 2;
|
||||
|
||||
points = rand_pts_circle(radius, number);
|
||||
points = rands_disk(radius, number);
|
||||
|
||||
for(p = points) {
|
||||
translate(p)
|
||||
|
Reference in New Issue
Block a user