Lookup reference for Part 1 (notes 01–07). Every key formula on one page, for revision and for checking hand work. Matrices use column vectors (p ′ = M p ); for row vectors (P ′ = P T , as in the SSG 511 assignment) transpose each one. The explanation of each formula lives in the linked note — this page is for after you have understood it.
frame buffer bytes = 8 W × H × bpp , pixel rate = W × H × refresh rate , ms per refresh = Hz 1000
N bits per pixel → 2 N colours.
Slope and DDA
m = d x d y , d x = x 2 − x 1 , d y = y 2 − y 1
steps = max ( ∣ d x ∣ , ∣ d y ∣ ) , x in c = steps d x , y in c = steps d y , x i + 1 = x i + x in c , y i + 1 = y i + y in c
Bresenham, 0 < m < 1 (step in x )
p 0 = 2 d y − d x , p k + 1 = { p k + 2 d y p k + 2 d y − 2 d x p k < 0 ( y stays ) p k ≥ 0 ( y + 1 )
Bresenham, m > 1 (step in y )
p 0 = 2 d x − d y , p k + 1 = { p k + 2 d x p k + 2 d x − 2 d y p k < 0 ( x stays ) p k ≥ 0 ( x + 1 )
Midpoint line: d 0 = 2 d y − d x ; d + = 2 d y (lower) or 2 ( d y − d x ) (upper).
x 2 + y 2 = r 2 , f ( x , y ) = x 2 + y 2 − r 2
Midpoint circle
p 0 = 1 − r , p k + 1 = { p k + 2 x k + 1 + 1 p k + 2 x k + 1 + 1 − 2 y k + 1 p k < 0 ( E ) p k ≥ 0 ( SE )
Bresenham circle
d 0 = 3 − 2 r , d k + 1 = { d k + 4 x k + 6 d k + 4 ( x k − y k ) + 10 d k < 0 d k ≥ 0
Eight-way symmetry: ( ± x , ± y ) and ( ± y , ± x ) about the centre.
Scan-line fill: next crossing x k + 1 = x k + d y d x (the edge’s inverse slope).
Region code (TBRL ): T if y > y ma x , B if y < y min , R if x > x ma x , L if x < x min . OR = 0000 → accept; AND ≠ 0000 → reject.
Cohen–Sutherland intersections
Top: y = y ma x , x = x 1 + m y ma x − y 1 Bottom: y = y min , x = x 1 + m y min − y 1
Right: x = x ma x , y = y 1 + m ( x ma x − x 1 ) Left: x = x min , y = y 1 + m ( x min − x 1 )
Liang–Barsky
x = x 0 + t d x , y = y 0 + t d y , 0 ≤ t ≤ 1
p 1 = − d x , q 1 = x 0 − x min p 2 = d x , q 2 = x ma x − x 0 p 3 = − d y , q 3 = y 0 − y min p 4 = d y , q 4 = y ma x − y 0
t E = max ( 0 , p k q k for p k < 0 ) , t L = min ( 1 , p k q k for p k > 0 )
Visible if t E ≤ t L . If p k = 0 and q k < 0 , reject.
Cyrus–Beck (outward normal N i , any edge point P E i , P ( t ) = P 0 + t D )
t i = N i ⋅ D N i ⋅ ( P E i − P 0 )
N i ⋅ D < 0 entering (keep the largest as t E ); N i ⋅ D > 0 leaving (keep the smallest as t L ).
3D: 6-bit codes; in clip space, inside means − w ≤ x , y , z ≤ w .
T ( t x , t y ) = 1 0 0 0 1 0 t x t y 1 , S ( s x , s y ) = s x 0 0 0 s y 0 0 0 1 , R ( θ ) = cos θ sin θ 0 − sin θ cos θ 0 0 0 1
Shear x ( k ) = 1 0 0 k 1 0 0 0 1 , Shear y ( k ) = 1 k 0 0 1 0 0 0 1 , Reflect x = diag ( 1 , − 1 , 1 )
About a point: M = T ( p x , p y ) R ( θ ) T ( − p x , − p y ) .
Row-vector rotation:
R ( θ ) T = cos θ − sin θ 0 sin θ cos θ 0 0 0 1
cos 30° = 0.866 , sin 30° = 0.5 , cos 60° = 0.5 , sin 60° = 0.866 .
T = 1 0 0 0 0 1 0 0 0 0 1 0 t x t y t z 1 , S = s x 0 0 0 0 s y 0 0 0 0 s z 0 0 0 0 1
R x = 1 0 0 0 0 c s 0 0 − s c 0 0 0 0 1 , R y = c 0 − s 0 0 1 0 0 s 0 c 0 0 0 0 1 , R z = c s 0 0 − s c 0 0 0 0 1 0 0 0 0 1
with c = cos θ , s = sin θ .
Homogeneous: ( x , y , z ) → ( x , y , z , 1 ) ; ( X , Y , Z , W ) → ( W X , W Y , W Z ) ; W = 0 is a direction.
Blocks: top-left 3 × 3 linear; right column translation; bottom row perspective; corner d uniform scale.
Vectors and Bézier curves → note 06
Affine and barycentric combinations
P = P 1 + t ( P 2 − P 1 ) = ( 1 − t ) P 1 + t P 2 , P = α 1 P 1 + α 2 P 2 + α 3 P 3 , α 1 = 1 − α 2 − α 3
Bernstein form
B ( t ) = ∑ i = 0 n P i B n , i ( t ) , B n , i ( t ) = ( i n ) t i ( 1 − t ) n − i , ∑ i = 0 n B n , i ( t ) = 1
Quadratic and cubic
P ( t ) = ( 1 − t ) 2 P 0 + 2 t ( 1 − t ) P 1 + t 2 P 2
B ( t ) = ( 1 − t ) 3 P 0 + 3 t ( 1 − t ) 2 P 1 + 3 t 2 ( 1 − t ) P 2 + t 3 P 3
Cubic in matrix form
B ( t ) = ( 1 t t 2 t 3 ) 1 − 3 3 − 1 0 3 − 6 3 0 0 3 − 3 0 0 0 1 P 0 P 1 P 2 P 3
Derivative and end conditions
B ′ ( t ) = ∑ i = 0 n − 1 B n − 1 , i ( t ) n ( P i + 1 − P i )
B ′ ( t ) = 3 [ ( 1 − t ) 2 ( P 1 − P 0 ) + 2 ( 1 − t ) t ( P 2 − P 1 ) + t 2 ( P 3 − P 2 ) ]
B ′ ( 0 ) = 3 ( P 1 − P 0 ) , B ′ ( 1 ) = 3 ( P 3 − P 2 ) , P 1 = P 0 + 3 v 0 , P 2 = P 3 − 3 v 1
B ( 2 1 ) = 8 P 0 + 3 P 1 + 3 P 2 + P 3
de Casteljau
P i r ( t ) = ( 1 − t ) P i r − 1 + t P i + 1 r − 1 , P i 0 = P i , B ( t ) = P 0 n ( t )
Split at t = s : the left edge P 0 0 , P 0 1 , P 0 2 , P 0 3 is the first part; the right edge (bottom up) the second. First half at s = 2 1 :
Q 0 = P 0 , Q 1 = 2 P 0 + P 1 , Q 2 = 4 P 0 + 2 P 1 + P 2 , Q 3 = 8 P 0 + 3 P 1 + 3 P 2 + P 3
Chaikin corner cutting (each edge P i P i + 1 )
Q i = 4 3 P i + 4 1 P i + 1 , R i = 4 1 P i + 4 3 P i + 1
B-splines (Cox–de Boor) → note 06
N i , 1 ( t ) = { 1 0 t i ≤ t < t i + 1 otherwise
N i , k ( t ) = t i + k − 1 − t i t − t i N i , k − 1 ( t ) + t i + k − t i + 1 t i + k − t N i + 1 , k − 1 ( t )
C ( t ) = ∑ i = 0 n P i N i , k ( t ) , t k − 1 ≤ t ≤ t n + 1 , t 0 ≤ t 1 ≤ ⋯ ≤ t n + k
Order k , degree k − 1 , continuity C k − 2 with distinct knots.
Geometry helpers → note 06
Point to segment A B
t = ∣ B − A ∣ 2 ( P − A ) ⋅ ( B − A ) , t ∗ = min ( 1 , max ( 0 , t )) , d = P − ( A + t ∗ ( B − A ) )
Flatness of a quadratic Bézier (max distance from the chord; halving divides it by 4)
δ = 4 ∣ P 1 − 2 P 2 + P 3 ∣
Regular n -gon , centre ( x c , y c ) , radius r
( x k , y k ) = ( x c + r cos n 360° k , y c + r sin n 360° k ) , k = 0 , … , n − 1
Visible surfaces → note 07
z = C − A x − B y − D , z ( x + 1 , y ) = z − C A , z ( x , y − 1 ) = z + C B
Back face (view direction V into the scene): V ⋅ N > 0 ; looking down − z , N z < 0 .
Depth-buffer memory: W × H × bytes per depth (1080p at 4 bytes ≈ 8.3 MB ).
▦ Subjects Jump to a subject ✕
Infrastructure & security