Anonymous user
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|
{{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,
table.insert( ng, love.math.random( 0,
table.insert( nb, love.math.random( 0,
end
love.graphics.setColor( {
love.graphics.setCanvas( canvas )
for y = 1, imgy do
Line 1,162:
end
--reset color
love.graphics.setColor( {
--draw points
for b = 1, num_cells do
Line 1,174:
function love.draw( )
--reset color
love.graphics.setColor( {
--draw diagram
love.graphics.draw( voronoiDiagram )
Line 1,181:
love.graphics.print( "space: regenerate\nesc: quit", 1, 1 )
--draw text
love.graphics.setColor( {
love.graphics.print( "space: regenerate\nesc: quit" )
end
|