• Function

A function is a variable quantity, whose value depends upon one or more independent variables.

y = ax + b is explicit form0 = ax – y + b is implicit form.

y depends upon the value of x, it is (y) called the dependent variable; and as x is independent of y, it is called the independent variable. We can also say that y is a function of x, and it can be written as y = f(x)

Example: V(A, h) means V (volume) function has two independent variables A (area), and h (height).

Values that independent variable can take are called domain, values that dependent variable can take are called range.

  •  Complex Numbers

One way to define complex numbers is z = x + iy where, x is real part, and y is imaginary part. We can also define complex numbers as z= |z|(cosß + isinß) where |z| is modulus of z, and ß is the counterclockwise angle between the modulus, and real axis x.

The first representation is in Cartesian coordinates, and it is called as rectangular or Cartesian form. The second representation is in polar coordinates, and it is called as polar form.

The relation between this two form is

x = |z|cosß        y = |z|sinß     ß = arctan(x/y)

In addition to these forms, we can also write complex numbers in matrix form as [x, -y; y, x]

As you can see, there is an obvious connection between complex number, and rotation. In fact, i is a 90 degree, counterclockwise rotation. Thus, we can easily say that multiplication of two complex numbers represents rotation.

Details for complex numbers can be found on Professor Joyce’s notes, Keith Matthews’ this chapter, complex numbers tutorial of Nipissing UniversityUnderstanding Why Complex Multiplication Works page, and euclideanspace.com

  • Vector

Vector has a magnitude, and direction. In computer graphics, we use unit vector because, unit vector simplifies the operations, and reduces the computation time.

A Cartesian vector is constructed from three unit vectors: i, j and k, aligned with the x, y and z-axis. Therefore, any vector aligned with the x, y or z-axis is a scalar multiple of the associated unit vector.

For example, 3i is aligned with the x-axis, with a magnitude of 3. 7j is aligned with the y-axis with a magnitude of 7, and 5k is aligned with the z-axis, with a magnitude of 5.

Cartesian vectors are represented as  r = ai +bj+ck (or r = [a b c]T in matrix form). Magnitude of r is calculated by |r| = sqrt(a^2 + b^2 +c^2).

If r and s are two vectors, and ß is the angle between these two vectors, then projection of r on s is calculated as |r|cos(ß) where |r| is the magnitude.

Dot Product

Dot product (aka scalar product) is used to calculate the angle between two vectors (The angle between two vectors is in [0, 180] range), lighting calculations (i.e. diffuse shading ( surfaceNormal dot lightDirection), and back face detection.

If we use the two vectors we defined above r•s is calculated as r•s=|r||s|cos(ß) = (XrXs + YrYs + ZrZs).

The last part of the formula is having from r•s = (Xri+ Yrj+Zrk) • (Xsi+Ysj+Zsk) operation. When we make this operation we have terms like i•i, j•j, k•k, i•j, i•k, j•k.  i•i = j•j = k•k = 1 (Because the angle between the same axes are 0, and cos(0) = 1), and i•j = i•k = j•k = 0 (Because the angle between these axes are 90, and cos(90) =0).

Lambertian Law: The law says that intensity of the illumination on a diffuse surface is proportional to the cosine of the angle between the surface normal vector, and the light source direction.

Or simply n • L where n is the surface normal, and L is the direction to the light source.

Back Face Detection: If the angle between the camera ray, and surface normal is less than 90 degree, the surface is visible. Otherwise, the surface is invisible.

Cross Product

With cross product (aka vector product) an new vector orthogonal to the two vectors is calculated ( t = r cross s). Cross product is used for surface normal calculation, which is used in lighting calculation later, and area calculation.

Cross product is defined as |t| = |r||s|sin(ß), where ß is the angle between r, and s vectors.

Area Calculation with Cross Product: Area of a parallelogram is calculated with the formula A = |r|h =|r||s|sin(ß).

In the school, we all memorized the area as “base times height“. So here, |r| is the base, and the height is calculated as |s|sin(ß).

For triangle we also take the half of the result which leads 1/2A = 1/2|r|h

References

  • Mathematics for Computer Graphics, John A. Vince, Springer; 3rd ed. 2010 edition (February 26, 2010)