mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 05:52:16 +02:00
don't cal repeatly
This commit is contained in:
@@ -5,7 +5,9 @@ function px_sphere(radius, filled = true) =
|
|||||||
for(z = -radius; z < radius; z = z + 1)
|
for(z = -radius; z < radius; z = z + 1)
|
||||||
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)
|
||||||
|
[
|
||||||
for(x = -radius; x < radius; x = x + 1)
|
for(x = -radius; x < radius; x = x + 1)
|
||||||
for(y = -radius; y < radius; y = y + 1)
|
for(y = -radius; y < radius; y = y + 1)
|
||||||
for(z = -radius; z < radius; z = z + 1)
|
for(z = -radius; z < radius; z = z + 1)
|
||||||
@@ -13,6 +15,6 @@ function px_sphere(radius, filled = true) =
|
|||||||
v = [x, y, z],
|
v = [x, y, z],
|
||||||
leng = norm(v)
|
leng = norm(v)
|
||||||
)
|
)
|
||||||
if(leng < radius && (leng * leng) > (radius * radius - 2 * radius) ) v
|
if(leng < radius && (leng * leng) > ishell) v
|
||||||
];
|
];
|
||||||
|
|
Reference in New Issue
Block a user