Computer Graphics · Unit 4 · 5 hrs
Three-Dimensional Geometric Transformation
Exam-focused notes for Three-Dimensional Geometric Transformation (Computer Graphics, CSC214): what the TU syllabus asks and how it has actually been tested, with 5 solved past questions from this unit.
Three-Dimensional Geometric Transformation in short
Extending transformations and viewing from two to three dimensions adds a $z$ coordinate to every point and matrix, and adds a genuinely new problem that 2D viewing never faced: collapsing three dimensions onto the two-dimensional screen through a projection. This chapter carries the 2D transformation matrices into their $4\times4$ homogeneous form, then covers the 3D viewing pipeline and the two families of projection.
What this unit covers
- Three-Dimensional translation, Rotation, Scaling, Reflection and Shearing
- Three-Dimensional Composite Transformations
- Three-Dimensional Viewing: Viewing pipeline, world to screen viewing transformation, Projection concepts(Orthographic, parallel, perspective projections)
Three-Dimensional Viewing
2081 · 5 marks
Differentiate between parallel projection and perspective projections. [5]
2080 · 10 marks
Differentiate between parallel and perspective projection with suitable diagram. Illustrate the window to viewport transformation with example.[10]
Show solved answerHide answer
Parallel vs Perspective Projection and Window-to-Viewport Transformation
Part 1: Parallel Projection vs Perspective Projection
Definition
Parallel Projection: In parallel projection, the projectors (lines of projection) are parallel to each other and perpendicular (or at an angle) to the projection plane. The center of projection is at infinity.
Perspective Projection: In perspective projection, the projectors converge at a single point called the center of projection (eye point or viewpoint). Objects farther away appear smaller, giving a realistic view.
Diagram
Parallel Projection
Object Projection Plane
A ---------> A'
B ---------> B' (parallel lines)
C ---------> C'
Projectors are parallel to each other
Perspective Projection
Projection Plane
A \ A'
B \----> Center -----> B'
C / of Projection C'
Projectors converge at one point (eye)
Differences Between Parallel and Perspective Projection
| Basis | Parallel Projection | Perspective Projection |
|---|---|---|
| Projectors | Parallel to each other | Converge at a single point |
| Center of Projection | At infinity | At a finite point |
| Realism | Less realistic | More realistic |
| Distance Effect | Object size does not change with distance | Farther objects appear smaller |
| Preservation | Preserves shape and size | Does not preserve shape and size |
| Usage | Engineering drawings, CAD | Computer graphics, games, animations |
| Complexity | Simpler to compute | More complex to compute |
| Types | Orthographic, Oblique | One-point, Two-point, Three-point |
Transformation Matrix
Parallel Projection onto the xy-plane:
$$M_{parallel} = \begin{bmatrix} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 0 & 0 \ 0 & 0 & 0 & 1 \end{bmatrix}$$
The z-coordinate is simply dropped (set to 0).
Perspective Projection (with center of projection at distance d along z-axis):
$$M_{perspective} = \begin{bmatrix} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 1/d & 0 \end{bmatrix}$$
The projected coordinates are:
$$x_p = \frac{x}{z/d}, \quad y_p = \frac{y}{z/d}$$
Part 2: Window to Viewport Transformation
Definitions
- Window: A rectangular region in the world coordinate system that defines what part of the scene is to be viewed.
- Viewport: A rectangular region on the display/screen device where the window contents are mapped and displayed.
Diagram
World Coordinate System Screen/Device Coordinate System
yw_max +--------+ yv_max +----------+
| | | |
| WINDOW | ========> | VIEWPORT |
| | | |
yw_min +--------+ yv_min +----------+
xw_min xw_max xv_min xv_max
Steps of Window to Viewport Transformation
The transformation is done in three steps (composite transformation):
Step 1: Translate window to origin
Move the lower-left corner of the window to the origin.
$$T_1 = T(-x_{w_{min}},\ -y_{w_{min}})$$
Step 2: Scale to viewport size
Scale the window so it matches the size of the viewport.
$$S = S(S_x,\ S_y)$$
Where the scaling factors are:
$$S_x = \frac{x_{v_{max}} - x_{v_{min}}}{x_{w_{max}} - x_{w_{min}}}$$
$$S_y = \frac{y_{v_{max}} - y_{v_{min}}}{y_{w_{max}} - y_{w_{min}}}$$
Step 3: Translate to viewport position
Move the scaled object to the viewport's actual position on screen.
$$T_2 = T(x_{v_{min}},\ y_{v_{min}})$$
Composite Transformation Matrix
$$T_{wv} = T(x_{v_{min}},\ y_{v_{min}}) \cdot S(S_x,\ S_y) \cdot T(-x_{w_{min}},\ -y_{w_{min}})$$
The final mapping equations for any point $(x_w, y_w)$ in the window to $(x_v, y_v)$ in the viewport:
$$\boxed{x_v = x_{v_{min}} + (x_w - x_{w_{min}}) \cdot S_x}$$
$$\boxed{y_v = y_{v_{min}} + (y_w - y_{w_{min}}) \cdot S_y}$$
Numerical Example
Given:
- Window: $x_{w_{min}} = 20,\ x_{w_{max}} = 80,\ y_{w_{min}} = 10,\ y_{w_{max}} = 60$
- Viewport: $x_{v_{min}} = 0,\ x_{v_{max}} = 40,\ y_{v_{min}} = 0,\ y_{v_{max}} = 30$
- Point in window: $P_w = (50, 40)$
Step 1: Calculate scaling factors
$$S_x = \frac{40 - 0}{80 - 20} = \frac{40}{60} = 0.667$$
$$S_y = \frac{30 - 0}{60 - 10} = \frac{30}{50} = 0.6$$
Step 2: Apply the mapping equations to $P_w = (50, 40)$
$$x_v = x_{v_{min}} + (x_w - x_{w_{min}}) \cdot S_x = 0 + (50 - 20) \times 0.667 = 30 \times 0.667 = 20.0$$
$$y_v = y_{v_{min}} + (y_w - y_{w_{min}}) \cdot S_y = 0 + (40 - 10) \times 0.6 = 30 \times 0.6 = 18.0$$
$$\boxed{P_v = (20,\ 18)}$$
Conclusion
The point $(50, 40)$ in the window maps to $(20, 18)$ in the viewport. This is exactly the composite transformation described above: translate the window's lower-left corner to the origin, scale by the ratio of viewport size to window size (here $S_x = 0.667$, $S_y = 0.6$, since the viewport is smaller than the window in both dimensions), then translate to the viewport's actual position on the screen. Because $S_x \neq S_y$ in this example, the mapping is a non-uniform scale, so shapes in the window are stretched differently along x and y once displayed in the viewport.
2078 · 10 marks
Question
Define orthographic, parallel, and perspective projections. Consider a region defined by the position vector P below, relative to global XYZ axis system. It is rotated by +30° about X-axis and passes through points (1.5, 1.5, 1.5). Find the final position of the region.
$$P = \begin{bmatrix} 1 & 1 & 2 & 1 \ 2 & 1 & 2 & 1 \ 2 & 2 & 2 & 1 \ 1 & 2 & 2 & 1 \end{bmatrix}$$
[10]
2077 · 5 marks
Differentiate between orthographies, parallel, and perspective projections. [5]
Three-Dimensional translation, Rotation, Scaling, Reflection and Shearing
2075 · 5 marks
Derive the relation for three-dimensional translation and rotation. [5]
Make Unit 4 stick
Practice CSC214 with flashcards & quizzes