Drawline asymmetry

BlitzMax Forums/BlitzMax Beginners Area/Drawline asymmetry

PoliteProgrammer(Posted 2009) [#1]
Hi, try running the following code and zooming in on the edges; you should notice that the vertices of the triangle don't look the same, as if the lines are not being drawn symmetrically. What's a way of working around this?

SuperStrict
Graphics(640,480)

While Not KeyDown(KEY_ESCAPE)
    Cls

    DrawLine(100,300,200,100)
    DrawLine(200,100,300,300)
    DrawLine(300,300,100,300)

    Flip
Wend
End



Floyd(Posted 2009) [#2]
What's a way of working around this?

Don't zoom in! Then it won't look so bad.

Seriously though, that's just way lines work. Consider the first line drawn. If we start at the top and proceed to the bottom we take 200 steps down and 100 steps left. These get rendered as 100 blocks which are 1x2 pixels. The line consists of 201 points i.e. a single point plus the 100 blocks.

One endpoint is in a block and the other is not.


jkrankie(Posted 2009) [#3]
you can add a true or a false to the end of drawline to say wheter or not you want the last pixel to be drawn. not sure which way round it is though.

Cheers
Charlie