Intro to Computer Graphics

Linear Algebra and Computer Graphics

Computer Graphics (CG) are pictures and figures created by using computers.

CG technique has been applied to diverse fields including architecture, video game, and medicine.


Drawing 2D and 3D figures on a computer screen often requires coordinate transformations.

This is why linear algebra (especially vectors and matrices) plays very important roles.

Preparation 1: Projective Geometry

Euclidean Geometry

coordinates in 2D space are
defined by x and y

Projective Geometry

w = 3

w = 1

Extra dimension, w, is added.

projective space
3D space with w

homogeneous coordinates
coordinates in projective space

homogeneous coordinates are
defined by x, y, and w

VS

Preparation 2: Linear Transformation and Translation

o    

Examples of Transformation Matrices

Rotation

[
cosθ  -sinθ
sinθ   cosθ
]

Scale

[
k  0
0  k
]

Skew

[
1  k
0  1
]

Reflection

[
1  0
0  -1
]
[
-1  0
0  1
]

Affine Transformation

[


]
[

]
 + 
[


]
 = 

Homogeneous Coordinate Transformation

What if I want to apply both rotation and translation at the same time?

o    

Instead of using 2D vectors, we are going to use 3D homogeneous vectors. (w = 1)

[



]

Order Matters!

The order of applying transformations influences the result.
This is because matrix multiplication is not commutative.

o    

Transformations are applied from right to left.

[



]
[



]

Perspective Projection (3D object projected onto 2D)

We need to convert 3D coordinates to 2D ones to display them on the computer screen.
Computer Graphics (CG) often uses perspective projection.

Perspective Projection (3D object projected onto 2D) cont.

o    


[




]
[




]

Works Cited

Matrices in Computer Graphics
https://sites.math.washington.edu/~king/coursedir/m308a01/Projects/m308a01-pdf/yip.pdf

Explaining Homogeneous Coordinates & Projective Geometry
https://www.tomdalling.com/blog/modern-opengl/explaining-homogenous-coordinates-and-projective-geometry/

コンピュータグラフィックス基礎
http://mitani.cs.tsukuba.ac.jp/lecture/2018/cg_basics/02/02_slides.pdf

OpenGL Tutorial - Tutorial 3
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/