- Asked 5/25
- 2073 Shrawan · 5 marks
- 2076 Chaitra · 8 marks
- 2068 Bhadra (old course) · 10 marks
- 2066 Magh (old course)
- 2069 Chaitra · 4 marks
2D viewing pipeline with matrices
Short answer
The 2D viewing pipeline maps world coordinates to device coordinates: modelling transformation places objects in world coords; viewing transformation aligns the window using R(-theta)T(-xw,-yw); clipping removes outside; window-to-viewport maps via M=T(xvmin,yvmin) S(sx,sy) T(-xwmin,-ywmin), with sx=(xvmax-xvmin)/(xwmax-xwmin), sy=(yvmax-yvmin)/(ywmax-ywmin); then device coords.
Explain the two-dimensional viewing pipeline (world to screen / window-to-viewport transformation): describe the different steps with matrix representation at each step.
The two-dimensional viewing pipeline is the sequence of transformations that converts a 2D scene described in world coordinates into the pixels of a viewport on the display device.
Steps of the 2D viewing pipeline
Modelling Modelling World Viewing
coordinates -> transform -> coordinates -> transform
|
Device <- Window-to-viewport <- Clipping <- Viewing
coordinates mapping (window) coordinates
- Modelling transformation: each object is defined in its own modelling coordinates and is placed into the common world coordinate system (WC) by translation, rotation and scaling.
- World to viewing coordinates (viewing transformation): a window (the part of the world to be displayed) is defined in WC. If the window is rotated by an angle θ and has reference point (xw, yw), the window is aligned with the axes: M = R(−θ) · T(−xw, −yw).
- Clipping: everything outside the window is removed (point, line, polygon clipping).
- Window-to-viewport mapping: the window is mapped to the viewport (the area of the screen on which the image appears), normally via normalised coordinates 0 to 1.
- Device coordinates: the viewport coordinates are given to the display device.
Matrices
Translate T(−xwmin, −ywmin): | 1 0 −xwmin |
| 0 1 −ywmin |
| 0 0 1 |
Scale S(sx, sy): | sx 0 0 |
sx = (xvmax−xvmin)/(xwmax−xwmin) | 0 sy 0 |
sy = (yvmax−yvmin)/(ywmax−ywmin) | 0 0 1 |
Translate T(xvmin, yvmin): | 1 0 xvmin |
| 0 1 yvmin |
| 0 0 1 |
Composite window-to-viewport: M = T(xvmin,yvmin) · S(sx,sy) · T(−xwmin,−ywmin)
| sx 0 xvmin − sx·xwmin |
M = | 0 sy yvmin − sy·ywmin |
| 0 0 1 |
Window-to-viewport equations:
xv = xvmin + (xw − xwmin)·sx
yv = yvmin + (yw − ywmin)·sy
If sx = sy, the shape is preserved; otherwise the picture is stretched or compressed.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- 3D world to viewing coordinate matrix · Computer Graphics, chapter 4 · asked 2×
- Short note: 2D viewing pipeline · Computer Graphics, chapter 3 · asked 2×
- 3D window to viewport transformation · Computer Graphics, chapter 4
- Rectangle window to viewport mapping · Computer Graphics, chapter 3
- Triangle window to viewport mapping · Computer Graphics, chapter 3
- 2D reflection matrices and line y+x=0 · Computer Graphics, chapter 3
- Steps for free body diagram; equilibrium 2D/3D · Applied Mechanics, chapter 2 · asked 2×
- Stiffness matrix: element matrices, member forces, BMD · Theory of Structures II, chapter 3
- Bar stiffness matrix and 2D truss element · Computational Techniques in Civil Engineering, chapter 4
- Add two matrices · Computer Programming, chapter 7