monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
629 stars 145 forks source link

Screen relative movements are inaccurate #412

Closed markwheeler closed 6 years ago

markwheeler commented 6 years ago

screen.move_rel(0, 0) causes things to move a little on both axes. It seems like all relative movements are slightly offset. Similar error in screen.line_rel()

tehn commented 6 years ago

@markwheeler

indeed there's a bug: https://github.com/monome/norns/blob/master/matron/src/hardware/screen.c#L255

this command shouldn't have the 0.5,0.5 offset. and many other similar bugs can be fixed.

so the issue is the "center" of the pixel is offset by 0.5,0.5. if you use 0,0 it's the "corner" of the pixel and the color will be darker as a result of anti-aliasing an off-center coordinate.

so it seems when typing up the lib i blindly applied this rule to a bunch of stuff that wasn't supposed to have it applied. particularly the _rel commands.

markwheeler commented 6 years ago

Ah yep I see. Looks like this applies to rect and arc also. I would expect screen.rect(0,0,1,1) to draw the top leftmost pixel but I have to offset by -0.5 on both axes to get it there.