Chapter 7
Coordinates, Windows, and Viewports

    ||
280--|
    |               world
    |
    |   |-------------|
210--  |||||    window |
    |||||  ||||       |
    ||  |    |        |
140--|  |    |    ||  |
    | -------- ||||||||
    |   |     ||      ||
   --   |      |      |
 70 |   |      |-------
    |   --------------
    |                    |
   -----|--|--|--|--|---|||
       50    150    250                          normalized device
                         coordinates
|
|    0.25       0.5       0.75       1|
Ymax-----------------------------screen--1
|   |-------------------           |
400   ||||||||     viewport|           --0.75
-   |      ||          |           |
300   -------|      |||  |           --
-   |       ||||||   |||           | 0.5
200   |         |        |           |
-   |         ----------           --0.25
100   --------------------           |
---|----|----|-----|----|----|-----|||-
0
0      200         400             Xmax

7.1 Window to Viewport Transformation

|
||  |----(xmax,ymax)-------
|   |                     •
|   |                     |
|   |    window           |
|  •-----------------------
|   (xmin,ymin)
|----------------------------|||

window        in

world      coordinates  |
||
|
|
|----------------------|
|                      |
|                      |
|                      |
-----------------------------|||

translate

to   origin

|
||------------------
|                  |
|                  |
|-----------       |
|          |       |
|          |       |
|----------|-----------------|||

scale    to

viewport        size |       (x‘      ,y‘      )
||---------max------max
|    |----------•- |
|    | view    - | |
|    |           | |
|    |--port-----| |
|    •(x‘     ,y ‘ |   )
|--------min------min--------|||

translate       to

viewport        position

T(xmin,ymin) . S(xmax-xmin xmax-xmin , ymax-ymin ymax-ymin ) . T(-xmin,-ymin)