Unit 6: Formula Sheet - Computer Graphics Notes - CSU358

Unit 6: Formula Sheet

1. Hardware & Display

Dot Clock Frequency
$$Dot~Clock \approx Total~Pixels \times Refresh~Rate$$
Frame Buffer Memory (Bits)
$$Memory = Width \times Height \times Bits\_per\_pixel$$
Frame Time
$$Frame~Time = \frac{1}{Refresh~Rate}$$
Aspect Ratio
$$AR = \frac{Width}{Height}$$
mindmap
  root((Hardware Math))
    Pixels
      Resolution (WxH)
      Aspect Ratio (W/H)
    Speed
      Refresh Rate (Hz)
      Frame Time (1/Hz)
      Dot Clock (Px * Hz)
    Storage
      Frame Buffer
      W * H * Depth
            

2. Line & Circle Algorithms

DDA Line

Steps Calculation
If $|dx| > |dy| \implies Steps = |dx|$
Else $\implies Steps = |dy|$
Increments
$$X_{inc} = \frac{dx}{Steps}, \quad Y_{inc} = \frac{dy}{Steps}$$

Bresenham Line

Initial Decision ($P_0$)
$$P_0 = 2dy - dx$$
Next Decision ($P_{k+1}$)
If $P_k < 0: P_{k+1}=P_k + 2dy$
If $P_k \ge 0: P_{k+1} = P_k + 2dy - 2dx$

Mid-Point Circle

Initial Decision ($P_0$)
$$P_0 = 1 - r$$
Next Decision ($P_{k+1}$)
If $P_k < 0: P_{k+1}=P_k + 2x + 1$
If $P_k \ge 0: P_{k+1} = P_k + 2x - 2y + 1$
mindmap
  root((Algo Math))
    Lines
      DDA (Decimals)
      Bresenham (2dy - dx)
    Circles
      Mid-Point (1-r)
      Next if <0 (2x+1)
      Next if >0 (2x-2y+1)
            

3. Transformations (2D & 3D)

2D Basic

Type Formula
Translation $x' = x + t_x$
$y' = y + t_y$
Scaling $x' = x \cdot s_x$
$y' = y \cdot s_y$
Rotation $x' = x\cos\theta - y\sin\theta$
$y' = x\sin\theta + y\cos\theta$

Review of Reflection

Reflection about $y=x$
$$x' = y, \quad y' = x$$
Reflection about $y=k$ (Line)
$$x' = x, \quad y' = -y + 2k$$

Shearing

X-Shear
$$x' = x + sh_x \cdot y, \quad y' = y$$
Y-Shear
$$x' = x, \quad y' = y + sh_y \cdot x$$

3D Rotation

About Z-Axis
$x' = x\cos\theta - y\sin\theta$
$y' = x\sin\theta + y\cos\theta$
$z' = z$
About X-Axis
$x' = x$
$y' = y\cos\theta - z\sin\theta$
$z' = y\sin\theta + z\cos\theta$
About Y-Axis
$x' = z\sin\theta + x\cos\theta$
$y' = y$
$z' = z\cos\theta - x\sin\theta$
mindmap
  root((Matrix Math))
    Move
      Translate (+)
    Resize
      Scale (*)
    Spin
      Rotate (Trig)
    Distort
      Shear (Add factor)
            

4. Projections & VSD

Perspective (Simple)
$$x' = x \cdot \frac{d}{z}, \quad y' = y \cdot \frac{d}{z}$$
Oblique Projection
$$x' = x + L \cdot z \cos\phi$$ $$y' = y + L \cdot z \sin\phi$$
Back-Face Test
$$V \cdot N > 0 \implies Hidden$$
Plane Equation
$$Ax + By + Cz + D = 0$$ $$z = \frac{-(Ax + By + D)}{C}$$
mindmap
  root((3D Formulas))
    Depth
      Plane Eq (Ax+By..)
      Z-Buffer (Compare Z)
    View
      Perspective (div Z)
      Oblique (+ Offset)
    Hidden
      Dot Product
      V dot N