Jump to content

Voronoi diagram: Difference between revisions

m
Updated to work with the latest version of LÖVE.
m (Phix/pGUI)
m (Updated to work with the latest version of LÖVE.)
Line 1,113:
=={{header|Lua}}==
{{libheader|LÖVE}}
{{works with|LÖVE|011.10.13}}
{{trans|Python}}
<lang lua>
Line 1,140:
table.insert( nx, love.math.random( 0, imgx ) )
table.insert( ny, love.math.random( 0, imgy ) )
table.insert( nr, love.math.random( 0, 2551 ) )
table.insert( ng, love.math.random( 0, 2551 ) )
table.insert( nb, love.math.random( 0, 2551 ) )
end
love.graphics.setColor( { 2551, 2551, 2551 } )
love.graphics.setCanvas( canvas )
for y = 1, imgy do
Line 1,162:
end
--reset color
love.graphics.setColor( { 2551, 2551, 2551 } )
--draw points
for b = 1, num_cells do
Line 1,174:
function love.draw( )
--reset color
love.graphics.setColor( { 2551, 2551, 2551 } )
--draw diagram
love.graphics.draw( voronoiDiagram )
Line 1,181:
love.graphics.print( "space: regenerate\nesc: quit", 1, 1 )
--draw text
love.graphics.setColor( { 2000.7, 2000.7, 0 } )
love.graphics.print( "space: regenerate\nesc: quit" )
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.