Xiaolin Wu's line algorithm: Difference between revisions

Content deleted Content added
OAbot (talk | contribs)
m Open access bot: url-access updated in citation with #oabot.
Algorithm: Fixes incorrect rendering of endpoints. Previously, integer endpoints were rendered at 50% brightness rather than 100%, contrary to Wu’s original 1991 algorithm.
Line 58:
 
// handle first endpoint
xend := roundfloor(x0)
yend := y0 + gradient * (xend - x0)
xgap := rfpart1 - (x0 +- 0.5xend)
xpxl1 := xend // this will be used in the main loop
ypxl1 := ipart(yend)
Line 73:
// handle second endpoint
xend := roundceil(x1)
yend := y1 + gradient * (xend - x1)
xgap := fpart1 - (x1xend +- 0.5x1)
xpxl2 := xend //this will be used in the main loop
ypxl2 := ipart(yend)