mtscad/context/dome.lua
BuckarooBanzay 5e281482b4 cylinder
2022-03-27 19:37:58 +02:00

15 lines
402 B
Lua

function mtscad.Context:dome(radius, hollow)
local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1)
for z = -radius, radius do
for y = 0, radius do
for x = -radius, radius do
local squared = x * x + y * y + z * z
if squared <= max_radius and (not hollow or squared >= min_radius) then
self
:translate(x, y, z)
:set_node()
end
end
end
end
end