Orthogonal Transformation: the transformation that preserve distance and origin
represented by matrices Q^T Q = I (orthogonal matrix)
Rotation: additionally preserve orientation (\det Q > 0)
Reflection: reverse orientation (\det Q < 0)
Scaling: preserve direction while change magnitude
Negative Scaling: a sequence of reflections (how many reflections depends on the dimension of the space)
in 2D: Negative Scaling is Rotation
in 3D: Negative Scaling is Reflection
Nonuniform Scaling: a symmetric matrix A := R^TDR
rotate to new axes (R)
apply a diagonal scaling (D)
rotate back to original axes (R^T)
Symmetric Matrix: a matrix A such that A = A^T.
has orthonormal eigenvectors e_1, ..., e_n \in \mathbb{R}^n
has real eigenvalues \lambda_1, ..., \lambda_n \in \mathbb{R}
Spectral Theeorem: all symmetric matrix represent non-uniform scaling along some set of orthogonal axes (by A = A^T \implies A = RDR^T where R = \begin{bmatrix} e_1, ..., e_n\\ \end{bmatrix}, R = \begin{bmatrix} \lambda_1 & & \\ & ... & \\ & & \lambda_n\\ \end{bmatrix})
if \lambda_i > 0e: then scaling is positive along corresponding e_i
Shear in direction u according to its distance along a fixed vector v is f_{u, v}(x) = x + (x \cdot v)u.
x: a vector in space.
u: Any vector to add. Displace point in the direction of this vector. Can be u = (\cos t, 0, 0)
v: A unit vector represent dirrection, orthogonal to sheer's parallel dirrection (parallel dirrection is dirrection with eigenvalues is 1). Displace those points according to its distance in. For example v = (0, 1, 0) says the bigger y component is, the more we move in direction u.
The transformation can be represented as A_{u, v} = I + uv^t \implies A_{u, v}x = Ix + u(v \cdot x)
// QUESTION: Can we linear time discompose a sheer to standard basis? Two sheers together is still a sheer or not?
No unique way to write a given linear transformation as a composition of basic transformations, but many useful decomposition:
Singular Value Decomposition: for signal processing
LU Factorization: solving linear systems
Polar Decomposition: for spatial transformation
Polar Decomposition: decompose A into orthogonal matrix Q and symmetric positive-semidefinite matrix P. So that A = QP.
Q: rotation and reflection
P: non-negative, possibly non-uniform scaling.
Spectral Decomposition: Since P is symmetirc, we can do spectral decomposition P = VDV^T where V is orthogonal and D is diagonal. So that A = QVDV^T
Singular Value Decomposition: A = QVDV^T = UDV^T where we combine two orthogonal matrix U = QV. (Every matrix has a singular value decomposition)
Interpolating Transformations:
Linear Decomposition: A(t) = (1-t)A_0 + tA_1 (awful in between frames)
Polar Decomposition: separately interpolate components of polar decomposition, making A_0 = Q_0P_0, A_1 = Q_1P_1. A(t) = Q(t)P(t)
where P(t) = (1 - t)P_0 + tP_1
where Q'(t) = (1-t)Q_0 + t Q_1 and Q'(t) = Q(t)X(t). Q is rotational component of Q'(t) after singular value decomposition.
Translation: it is not linear transformation (it is affine
). We can make transformation linear using 4th dimension with Homogeneous Coordinates.
Idea of Homogeneous Coordinates: Fix origin o and a point in 2D space specified by plane z = 1 p \in \mathbb{R}^2 can be represented by any points (except the origin) along the line that contains o and p.
\hat{p} = (a, b, c) such that (\frac{a}{c}, \frac{b}{c}) = (x, y) = p are homogeneous coordinates for p.
\hat{p}, \hat{q} \in \mathbb{R}^3 - \{o\} describe the same point in 2D (and line in 3D) if \hat{p} = \lambda \hat{q} for some \lambda \neq 0
Proof it is a sheer ing 3D:
For 2D Coordinate: (p_1, p_2) + (u_1, u_2) = (p_1 + u_1, p_2 + i_2)
For Homogeneous Coordinates: (cp_1, cp_2, c) + (u_1, u_2) = (cp_1 + cu_1, cp_2 + cu_2, c) (it is a shear because we are shifting x and y coordinates by amount that is proportional to z.)
A sheer in matrix form: f_{u, v}(x) = (I + uv^T)x. For the use in homogeneous coordinates to represent 2D coordinates, it is always the case v = (0, 0, 1). So we have matrix \begin{bmatrix}1 & 0 & u_1\\ 0 & 1 & u_2\\ 0 & 0 & 1\\ \end{bmatrix}. Observe the following:
Advantages:
We can do rotation in 2D as rotation in 3D in homogeneous coordinates.
We can do scaling in 2D as scaling with only 2D coordinates in 3D.
We can do 2D translation as shear in 3D.
In general:
A point in 3D will have a non-zero homogeneous coordinate (c \neq 0)
A vector in 3D (like normal) will have a zero homogeneous coordinate (c = 0)
The problem is, when we want to convert vector in homogeneous coordinate back to 3D coordinate, we might encounter division by 0 (since c = 0)
Mathematical intuition: as c \rightarrow 0, we get vectors that represent a line (or a direction towards infinity), which is intuitive for unit vectors since they suppose to only give us a direction.
Practical solution: branch if
to check for 0.
Note: Keep transformation on a stack to reduce redundant multiplication
push()
a transformation (from body position to leg position)pop()
a transformation (from leg position to body position)
Instancing: Used to draw many copies of the same object in a scene. It can save memory so that the same model only get loaded once in the tree.
Table of Content