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