A swift and brutal review of Linear Algebra
Computer Graphics’ Dependencies
- Basic mathematics
- Linear algebra
- Calculus
- Statistics
- Basic physics
- Optics (Advanced: if we could not suppose the light travels in straight lines but interacts with a surface material in a form of light wave?)
- Mechanics
- Misc.
- Signal processing (for anti-alias)
- Numerical analysis (rendering is to find a solution of calculus defined by recursion, simulation is to solve FEA, Finite Element Analysis, or diffusion equation)
- A bit of aesthetics
Vector
- Direction and length
- Usually written as →a or using start and end point →AB
- No absolute starting position
Vector Normalization
- Magnitude (length) of a vector written as |→a|
- Unit vector
- A vector with length of 1
- ˆa=→a/|→a|
- represent directions
Vector Addition
- Geometrically: Parallelogram law & Triangle law
- Algebraically: Simply add coordinates
Dot (scalar) Product
→a⋅→b=|→a||→b|cosθ
For unit vectors:
cosθ=ˆa⋅ˆb
Some properties:
→a⋅→b=→b⋅→a
→a⋅(→b+→c)=→a⋅→b+→a⋅→c
(k→a)⋅→b=→a⋅(k→b)=k(→a⋅→b)
For component-wise multiplication of vectors in Cartesian coordinates:
→a⋅→b=(xayaza)⋅(xbybzb)=xaxb+yayb+zazbFour common usages of dot product:
- To find angle between two vectors
-
To find projection of one vector on another:
To Calculate →b⊥: projection of →b onto →a
- →b⊥ must be along →a, thus →b⊥=kˆa
- The magnitude of k is |→b⊥|=|→b|cosθ
- To measure how close two directions are
- To decompose a vector: →b, →b⊥, →b−→b⊥
Cross Product
|a×b|=|a||b|sinϕ
- Cross product is orthogonal to two initial vectors
- Direction determined by right-hand rule
- To construct coordinate systems
Some properties:
→a×→b=−→b×→a
→a×→a=→0
→a×(→b+→c)=→a×→b+→a×→c
→a×(k→b)=k(→a×→b)
For cross product in Cartesian Formula:
→a×→b=(yazb−ybzazaxb−xazbxayb−yaxb)Or using matrix form:
→a×→b=A∗b=(0−zayaza0−xa−yaxa0)(xbybzb)Two common usages of cross product:
- To determine left/right: check if the cross product of two vectors points to the outside of the screen or out.
- To determine inside/outside: check if the cross product of →AB×→AP and →BP×→BP and →CA×→CP all directed to the outside of the screen.
Orthonormal Coordinate
We can decompose any vectors →p by 3 unit vectors:
→p=(→p⋅→u)→u+(→p⋅→v)→v+(→p⋅→w)→w
, where
|→u|=|→v|=|→w|=1
→u⋅→v=→v⋅→w=→u⋅→w=0
→w=→u×→v
Matrix
- 2D arrays that haunt in every CS course
- In Graphics, pervasively used to represent transformations
Matrix-Matrix Multiplication
- columns in A must = rows in B
- Element (i, j) in the product is the dot product of
row i from A
andcolumn j from B
Some properties:
- Non-commutative: (AB and BA are different in general)
- Associative and distributive:
- (AB)C=A(BC)
- A(B+C)=AB+AC
Matrix-Vecotr Multiplication
- Treat vector as a column matrix (Mx1)
- Treat vector as the right multiplier of the matrix (as a point)
- Key for transforming points
Transpose of a Matrix
- Switch rows and columns (ij to ji)
- (AB)T=BTAT
Identity Matrix and Inverses
I3×3=(100010001)AA−1=A−1A=I
(AB)−1=B−1A−1
Reference
PREVIOUSMaterial
Gitalking ...