mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 21:41:41 +02:00
add px_sphere
This commit is contained in:
18
src/pixel/px_sphere.scad
Normal file
18
src/pixel/px_sphere.scad
Normal file
@@ -0,0 +1,18 @@
|
||||
function px_sphere(radius, filled = true) =
|
||||
filled ? [
|
||||
for(x = -radius; x < radius; x = x + 1)
|
||||
for(y = -radius; y < radius; y = y + 1)
|
||||
for(z = -radius; z < radius; z = z + 1)
|
||||
let(v = [x, y, z])
|
||||
if(norm(v) < radius) v
|
||||
] : [
|
||||
for(x = -radius; x < radius; x = x + 1)
|
||||
for(y = -radius; y < radius; y = y + 1)
|
||||
for(z = -radius; z < radius; z = z + 1)
|
||||
let(
|
||||
v = [x, y, z],
|
||||
leng = norm(v)
|
||||
)
|
||||
if(leng < radius && (leng * leng) > (radius * radius - 2 * radius) ) v
|
||||
];
|
||||
|
Reference in New Issue
Block a user