lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 4/24/2018 5:10 PM, Axel Kittenberger wrote:
    In my opinion we should bring back the old compromise of
    starting arrays at 0.5


I was going to make that argument. It's not about counting, it's about indexing and when you think about lining up objects on a tape, the first item starts at position 0 and stops at position 1 -- I hope there is no doubt about that. As the first centimeter on the tape starts at zero and stops at centimeter one. The question in addressing is then, do you specify start or stop positions. And actually one can make an argument to specify the middle.. and this is exactly what HTML5 canvas does. If you want to draw the top pixel line, it's position is 0.5 -- as long devicePixelRatio is 1 to keep things not extra complicated, which they can on nowadays common HiPDI screens. But do be fair, HTML5 canvas wanted to abstract Pixels away, that's way the result if one want to draw a line on a pixel boundary, the result is the somewhat comically n dot 5.

This is in a lot of OpenGL stuff, and it has to do with rendering. Can't remember, probably a position marks the center of the pixel. Traditional bitmap blitting is only a small subset these days, so stuff tend to be derived more from OpenGL and other 3D graphics libs, hence the appearance of 0.5. Nothing surprising actually, all reasonable stuff.


@Dirk, well about retelling old jokes: Okay, so at those times when most people where doing stuff byusing only ones and zeros, you only used ones.



--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia