Page 49 - DCAP504_Computer Graphics
P. 49

Computer Graphics



                          The following figure 4.2 depicts scan converting a line.

                                                       Figure 4.2: Scan Converting  a Line
































                          In figure 4.2, the coordinates of the last chosen pixel are (x i , y i ).  Choose the next pixel between the
                          bottom pixel S and the top pixel T.
                          If S is chosen,
                          x i+1 =x i +1

                          y i+1 =y i
                          If T is chosen,

                          x i+1 =x i +1
                          y i+1 =y i +1
                          The actual y coordinate of the line at x=x i+1  is:

                           y=mx i+1 +b
                           i.e., y=m(x i +1)+b

                          The distance from S to the actual line in the y direction is:
                          s=y-y i
                          The distance from T to the actual line in the y direction is:

                          t=(y i +1)-y







                          42                      LOVELY PROFESSIONAL UNIVERSITY
   44   45   46   47   48   49   50   51   52   53   54