All You Need to Know About Computer Graphics

There are just a few basic ideas that are used over and over again in computer graphics. Here are the ones I find most important for a basic course.

Inner Products

The inner, or dot, or scalar product of two vectors is a number. It can represent a length or the scaled cosine of the angle between two vectors. We've mostly interested in vectors of length three (3) or four (4). We'll write inner products of vectors $\vec{v}$ and $\vec{w}$ as

\begin{displaymath}\langle \vec{v} \vert \vec{w}\rangle=\sum_{i=0}^{n}v_iw_i.\end{displaymath}

It is also useful to represent the inner product in matrix form

\begin{displaymath}\langle \vec{v} \vert \vec{w}\rangle = v^T w =
(v_0,\ldots,v_...
...}w_0\\ \vdots\\ w_n\\ \end{array}\right)= \sum_{i=0}^{n}v_iw_i.\end{displaymath}

Matrices

Matrices can be thought of as collections of vectors. Most of our matrices will be $4\times 4$ and used to transforms points from one coordinate systems to another. We'll write matrices as

\begin{displaymath}M=\left(\begin{array}{cccc}
a_{00} & a_{01} & a_{02} & a_{0...
...\\
a_{30} & a_{31} & a_{32} & a_{33} \\
\end{array}\right).\end{displaymath}

Cross Products

The cross product of two three dimensional vectors is another vector: The cross product vector is perpendicular to the other two vectors. Let $\vec{v}$ and $\vec{w}$ be two three dimensional vectors. Their cross product is

\begin{displaymath}\vec{v} \times \vec{w} = (v_1w_2 - v_2w_1,\, v_2w_0 - v_0w_2,\, v_0w_1-v_1w_0).\end{displaymath}

Parametric Lines

Lines are extremely important in computer graphics. The parametric representation is perhaps the most useful form. If $P = (p_0,\,p_1,\,p_2)$ and $Q = (q_0,\,q_1,\,q_2)$are two points the line defined by them is:

\begin{displaymath}P(1-t) + Qt = P + (Q-P)t,\,-\infty < t < \infty.\end{displaymath}

Restricting the parameter t to lie between 0 and 1 produces the line segment from P to Q.

Polygons

Polygons are simply figures enclosed by contiguous line segments that connect points or vertices or corners of the polygon. A triangle is the most simple polygon, squares and rectangles are also simple. Polygons can become complex. We'll need to make some restrictions on what types of polygons we'll allow in a graphics systems later.

Homogeneous Coordinates

Homogeneous coordinates are formed appending and extra coordinate with value 1. For example,

\begin{displaymath}(x,\,y,\,z) \rightarrow (x, \, y,\,z,\,1).\end{displaymath}

More generally, we can multiply the homogeneous point by a parameter w as long as it is not zero.

\begin{displaymath}(x,\,y,\,z) \rightarrow (wx, \, wy,\,wz,\,w),\,w\neq 0.\end{displaymath}

Coherence and Incremental Algorithms

``Things close by in time or space are frequently similar.''
This concept applies in many areas of computer science, certainly not just in graphics.

Incremental algorithms follow from noticing coherent patterns. They are distinguished by the use of one (or more) old values to generate a new value. For example, if you know $(x',\,y')$ is a point on a line y=mx+band x' is incremented by 1, then we can compute a new y by simply adding the slope m, that is

(x'+1, y'+m)

is on the line.

Linear interpolation

Linear interpoations is basis for many incremental algorithms. When a value y changes via a linear formula: y=mx+b, a change in x by an amount $\triangle x$, results in a new value of y that is produced by adding increment $m\triangle x$ to y.

Triage

An algorithmic concept that says: ``serve the greatest good.'' Usually, this is interpreted as ``make the common case fast.''



William Shoaff
2000-06-12