1
0
mirror of https://github.com/HybridDog/riesenpilz.git synced 2025-12-04 21:05:27 +01:00

Remove vector_extras dependency

This commit is contained in:
HybridDog
2021-10-24 19:16:08 +02:00
parent dc64c2fb6e
commit 6257c39406
4 changed files with 35 additions and 14 deletions

View File

@@ -17,3 +17,22 @@ else
function riesenpilz.inform()
end
end
local circle_tables = {}
function riesenpilz.circle(r)
local circle = circle_tables[r]
if circle then
return circle
end
local circle, n = {}, 1
for i = -r, r do
for j = -r, r do
if math.floor(math.sqrt(i * i + j * j) + 0.5) == r then
circle[n] = {x=i, y=0, z=j}
n = n+1
end
end
end
circle_tables[r] = circle
return circle
end