CS410 & CS410DL: Introduction to Computer Graphics
Fall 2012
Computer Science Department
CS 410 Slide Packet 09
Question: what difference does it make by interchanging x1 and x2? Either way its going to be the same answer right? Or am i wrong?
Answer: It does make a difference in terms of the mechanics of the algorithm. Note at this point in the development of the algorithm only lines with slope between zero and one are being handled. Further, the iteration step increments x by one each time through the loop. There lies the true answer to why it matters. One could develop a count down instead of a count up variant but it would look different, choosing between west and southwest, and decrementing x instead of incrementing x each time. In terms of actual mechanics, the two possible variants are not identical, and hence the easiest thing (and what is done in practice) is to swap endpoints rather than have to write alternative variants of the code. Hope that helps ... Ross (10/13/12)