1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-14 18:54:41 +02:00

use range

This commit is contained in:
Justin Lin
2019-06-28 06:38:15 +08:00
parent 3b57412108
commit d9199bf9ed

View File

@@ -1,16 +1,17 @@
function px_sphere(radius, filled = true) = function px_sphere(radius, filled = true) =
let(range = [-radius: radius - 1])
filled ? [ filled ? [
for(x = -radius; x < radius; x = x + 1) for(x = range)
for(y = -radius; y < radius; y = y + 1) for(y = range)
for(z = -radius; z < radius; z = z + 1) for(z = range)
let(v = [x, y, z]) let(v = [x, y, z])
if(norm(v) < radius) v if(norm(v) < radius) v
] : ] :
let(ishell = radius * radius - 2 * radius) let(ishell = radius * radius - 2 * radius)
[ [
for(z = -radius; z < radius; z = z + 1) for(z = range)
for(y = -radius; y < radius; y = y + 1) for(y = range)
for(x = -radius; x < radius; x = x + 1) for(x = range)
let( let(
v = [x, y, z], v = [x, y, z],
leng = norm(v) leng = norm(v)