Now we need to transform to Physical Device Coordinates (PDC), which we can do by just multiplying the Normalized Device Coordinates (NDC) by the resolution in pixels.
Xp = Xv * Xnum
Yp = Yv * Ynum
Note: Remember the aspect ratio problem, e.g., for CGA mode 6 (640 x 200) =>2.4 horizontal pixels = 1 vertical pixel.
Therefore: 200 vertical pixels = 480 horizontal. pixels
so use Ynum = 199 {0 => 199}
Xnum = 479 {0 =>479}
Also have problem with 0, 0 being upper left rather than lower left so actual equation used is:
Xp = Xv * Xnum
Yp = Ynum - Yv * Ynum
As a check if
Xv = 0.0 => Xp = 0 ( left )
Xv = 1.0 => Xp = 479 ( right )
Yv = 0.0 => Yp = 199 - 0 = 199 (Bottom)
Yv = 1.0 => Yp = 199 - 199 = 0 (Top)
2D Viewing
Transformation Main page
HyperGraph Table of Contents.
HyperGraph Home page.