Page 101 - DCAP504_Computer Graphics
P. 101

Computer Graphics





                          Figure 7.4 illustrates the mapping of an image.

                                                    Figure 7.4: Window-to-Viewport Mapping






































                          Figure 7.4 given above discusses how an image in the window is mapped onto the viewport.
                          Development of the Window-to-Viewport Mapping

                          Window to viewport mapping is achieved through in-built developing formulae. Since, mapping of the
                          object should be achieved in equal ratio. The formulae start at a point in the world window like (XW,
                          YW).  The formula helps to produce a corresponding point in the viewport coordinates, (XV, YV). The
                          mapping has to be proportional.



                                             If XW is 40 per cent of the way from the right edge of the world window, then
                                             XV is 30% of the way from the right edge of the viewport. Similarly, if YW is
                                             40per cent of the way from the top edge of the world window, then YV is 40
                                             percent of the way from the top edge of the viewport.

                          The formula  is used to produce a corresponding point in viewport coordinates, say (XV, YV). The
                          mapping achieved is proportional. Let us assume that in figure 7.4, if XW as well as YW is 30% away
                          from the bottom edge of the world window, then YV and XV of the viewport is also 30% away from the
                          bottom edge.












                          94                      LOVELY PROFESSIONAL UNIVERSITY
   96   97   98   99   100   101   102   103   104   105   106