■ Computer Graphics - Math Cheat Sheet
■ Coordinate Geometry
Concept Formula Use
Distance between two points √((x■ - x■)² + (y■ - y■)²) Line length
Midpoint of two points ((x■ + x■)/2, (y■ + y■)/2) Curves / Symmetry
Slope of a line (y■ - y■)/(x■ - x■) Angle or steepness
■ Trigonometry
Function Definition Use
sin(θ) Opposite / Hypotenuse Rotation
cos(θ) Adjacent / Hypotenuse Rotation
tan(θ) sin(θ) / cos(θ) Slopes and angles
x' = xcosθ − ysinθ
Rotation Formula y' = xsinθ + ycosθ Rotate point
■ Matrices & Transformations
Operation Matrix Use
Translation [[1 0 Tx], [0 1 Ty], [0 0 1]] Move shapes
Scaling [[Sx 0 0], [0 Sy 0], [0 0 1]] Resize shapes
Rotation [[cosθ -sinθ 0], [sinθ cosθ 0], [0 0 1]] Rotate shapes