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: 730 / 311
Referenced in: #1003263 - Stylesheet for Blog
#1003349 - Output of Google Video Search
#1016322 - CSS for BotCompany.de
#1020396 - side-menu.css
#1025977 - bootstrap.min.css v3.3.0
#1030364 - gazelle_logInFormCSS
#1032364 - HHamburgerIcon
#2000304 - Contents of http://tinybrain.blog.de for #2000303
#2000305 - Contents of http://tinybrain.blog.de for #2000303
#2000526 - Marked titles (beginning), contents of http://tinybrain.blog.de
#3000000 - Contents of http://tinybrain.blog.de
#3000001 - Contents of http://tinybrain.blog.de
#3000002 - Contents of http://tinybrain.blog.de
#3000005 - Contents of http://tinybrain.blog.de
#3000009 - Contents of http://tinybrain.blog.de
#3000024 - Contents of http://tinybrain.blog.de
#3000033 - Contents of http://tinybrain.blog.de
#3000050 - Contents of http://tinybrain.blog.de
#3000133 - Contents of http://tinybrain.blog.de
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)