1 | i, j, px, py = string.find(result, "([0-9.]+),%s*([0-9.]+)") |
2 | px, py = math.floor(px+0.5), math.floor(py+0.5) |
3 | |
4 | -- copy image |
5 | |
6 | w, h = img.width, img.height |
7 | pixels = {} |
8 | for y = 0, h-1 do |
9 | for x = 0, w-1 do |
10 | pixels[y*w+x+1] = img.getInt(x, y) |
11 | end |
12 | end |
13 | |
14 | -- paint point |
15 | |
16 | for y = math.max(py-1, 0), math.min(py+1, h-1) do |
17 | for x = math.max(px-1, 0), math.min(px+1, w-1) do |
18 | pixels[y*w+x+1] = 0xFF0000 |
19 | end |
20 | 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: | 785 / 332 |
Referenced in: | [show references] |