Why have the diamonds been shown here? The algorithm doesn't seem to make use of diamonds. Also, what happens when v=x.5 ? do we arbitrarily round up/down or is there some meaningful strategy ?
JavaSwing
Are there strategies for adding different shades to different pixels as well?
wdc
Are there performance concerns in deciding what values to use for s?
Andy
In this example, the horizontal increment is fixed at 1 for the variable u. How shall we strike a balance between the efficiency and the clarity of the line when determining the amount of increment in a real application which requires the drawing of very long lines or a huge number of lines?
wenere
Would it work if it is a steep line rather than a flat one?
JimL
@rmvenkat A very interesting question!!! I think you are right that the diamond rule do not need to be applied in this case. But here we did do some simplifications. Because the u value is always in the center of a pixel (u=x.0), the v will always lie in the diamond. But the start and end of a line will not always be in the center of a pixel, see the example here: https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-rasterizer-stage-rules
I think the core idea of incremental line rasterization is to leverage the slope to avoid pixel based operation (iterate through all the pixel), and for every pixel that the line might come through (calculated by the slope), we do the diamond test.
What about curves or other complicated shapes?
Why have the diamonds been shown here? The algorithm doesn't seem to make use of diamonds. Also, what happens when v=x.5 ? do we arbitrarily round up/down or is there some meaningful strategy ?
Are there strategies for adding different shades to different pixels as well?
Are there performance concerns in deciding what values to use for s?
In this example, the horizontal increment is fixed at 1 for the variable u. How shall we strike a balance between the efficiency and the clarity of the line when determining the amount of increment in a real application which requires the drawing of very long lines or a huge number of lines?
Would it work if it is a steep line rather than a flat one?
@rmvenkat A very interesting question!!! I think you are right that the diamond rule do not need to be applied in this case. But here we did do some simplifications. Because the u value is always in the center of a pixel (u=x.0), the v will always lie in the diamond. But the start and end of a line will not always be in the center of a pixel, see the example here: https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-rasterizer-stage-rules I think the core idea of incremental line rasterization is to leverage the slope to avoid pixel based operation (iterate through all the pixel), and for every pixel that the line might come through (calculated by the slope), we do the diamond test.