top of page

7_RA

  • hrafnulf13
  • Nov 2, 2020
  • 2 min read

Updated: Nov 4, 2020

The viewport is an area on the screen which is used to display the object. The window is an area space for the object. Viewport surrounds the object. It is required to coordinate transformation to display the object on the screen. There can be many viewports on a different area of the screen and also see the same object from a different angle in the viewport [3].


Window to Viewport Transformation is the process of transforming a 2D world-coordinate objects to device coordinates [1, 3]. The object inside the clipping window is mapped to the viewport. The viewport is displayed inside the interface window on the screen. The clipping window can be used to select the part of an object, and the viewport is used to display the selected part of the object on the screen or output device.



In order to maintain the same relative placement of the point in the viewport as in the window, it is required:


(Xv - Xvmin) / (Xvmax - Xvmin) = (Xw - Xwmin) / (Xwmax - Xwmin)

and

(Yv - Yvmin) / (Yvmax - Yvmin) = (Yw - Ywmin) / (Ywmax - Ywmin)


Solving these impressions for the viewport position (Xv, Yv):


Xv = Xvmin + (Xw - Xwmin) * Sx

and

Yv = Yvmin + (Yw - Ywmin) * Sy


where,

Sx = (Xvmax - Xvmin) / (Xwmax - Xwmin)

and

Sy = (Yvmax - Yvmin) / (Ywmax - Ywmin)


Matrix representation:


First, translate window to origin


Tx = -Xwmin

and

Ty = -Ywmin


Then, scale the window to match its size to the viewport


Sx = (Xvmax - Xvmin) / (Xwmax - Xwmin)

and

Sy = (Yvmax - Yvmin) / (Ywmax - Ywmin)


Again translate viewport to its correct position on screen


Tx = Xvmin

and

Ty = Yvmin


Above three steps can be represented in matrix form:


VT = T * S * T1


VT = Viewing Transformation

T = Translate window to the origin

S = Scaling of the window to viewport size

T1 = Translating viewport on screen.











 

References


Recent Posts

See All
14_RA

The Euler–Maruyama method (also called the Euler method) is a method for the approximate numerical solution of a stochastic differential...

 
 
 

Comments


bottom of page