Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #333 // Point Visualizer

Lua code - Visualizer

i, j, px, py = string.find(result, "([0-9.]+),%s*([0-9.]+)")
px, py = math.floor(px+0.5), math.floor(py+0.5)

-- copy image

w, h = img.width, img.height
pixels = {}
for y = 0, h-1 do
  for x = 0, w-1 do
    pixels[y*w+x+1] = img.getInt(x, y)
  end
end

-- paint point

for y = math.max(py-1, 0), math.min(py+1, h-1) do
  for x = math.max(px-1, 0), math.min(px+1, w-1) do
    pixels[y*w+x+1] = 0xFF0000
  end
end

test run  test run with input  download  show line numbers   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, znullqslnikg

No comments. add comment

Snippet ID: #333
Snippet name: Point Visualizer
Eternal ID of this version: #333/1
Text MD5: e06db67e6d48e8c622373eb814e76c19
Author: stefan
Category: ir result visualizers
Type: Lua code - Visualizer
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-02-03 21:25:08
Source code size: 433 bytes / 20 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 784 / 331
Referenced in: [show references]