2.5.3 Transformation Equations

GDI uses the following equations to transform logical points to device points, and device points to logical points:

Transforming logical points to device points:

Dx = (Lx – xWO) ´ xVE/xWE + xVO
Dy = (Ly – yWO) ´ yVE/yWE + yVO

Transforming device points to logical points:

Lx = (Dx – xVO) ´ xWE/xVE + xWO
Ly = (Dy – yVO) ´ yWE/yVE + yWO

The following list describes the variables used in these transformation equations:

Variable Description  
xWO Window origin x-coordinate  
yWO Window origin y-coordinate  
xWE Window extent x-coordinate  
yWE Window extent y-coordinate  
xVO Viewport origin x-coordinate  
yVO Viewport origin y-coordinate  
xVE Viewport extent x-coordinate  
yVE Viewport extent y-coordinate  
Lx Logical-coordinate system x-coordinate  
Ly Logical-coordinate system y-coordinate  
Dx Device x-coordinate  
Dy Device y-coordinate  

The following four ratios are scaling factors:

xVE/xWE

yVE/yWE

xWE/xVE

yWE/yVE

They are used to determine the necessary stretching or compressing of logical units. The subtraction and addition of viewport and window origins is referred to as the translational component of the equation.