Bitmap/Midpoint circle algorithm: Difference between revisions

m
→‎{{header|Lua}}: corrected axes
(→‎{{header|Lua}}: added Lua solution)
m (→‎{{header|Lua}}: corrected axes)
Line 1,255:
<lang lua>function Bitmap:axes()
local hw, hh = math.floor(self.width/2), math.floor(self.height/2)
for i = 10, self.width-1 do self:set(i,hh,"-") end
for i = 10, self.height-1 do self:set(hw,i,"|") end
self:set(hw,hh,"+")
end
Line 1,275:
bitmap:render()</lang>
{{out}}
<pre>· · · · · · · · · · · · ·| · · · · · · · · · · · ·
· · · · · · · · · ■ ■ ■ ■ ■ ■ ■ · · · · · · · · ·
· · · · · · · ■ ■ · · · | · · · ■ ■ · · · · · · ·
Line 1,287:
· ■ · · ■ · · ■ · · · ■ ■ ■ · · · ■ · · ■ · · ■ ·
· ■ · · ■ · · ■ · · ■ · | · ■ · · ■ · · ■ · · ■ ·
·- ■ - - ■ - - ■ - - ■ - + - ■ - - ■ - - ■ - - ■ -
· ■ · · ■ · · ■ · · ■ · | · ■ · · ■ · · ■ · · ■ ·
· ■ · · ■ · · ■ · · · ■ ■ ■ · · · ■ · · ■ · · ■ ·
Anonymous user