Chapter 22. Computer Graphics

Computer Graphics algorithms create and render virtual worlds stored in the computer memory. The virtual world model may contain shapes (points, line segments, surfaces, solid objects etc.), which are represented by digital numbers. Rendering computes the displayed image of the virtual world from a given virtual camera. The image consists of small rectangles, called pixels. A pixel has a unique colour, thus it is sufficient to solve the rendering problem for a single point in each pixel. This point is usually the centre of the pixel. Rendering finds that shape which is visible through this point and writes its visible colour into the pixel. In this chapter we discuss the creation of virtual worlds and the determination of the visible shapes.

22.1. 22.1 Fundamentals of analytic geometry

The base set of our examination is the Euclidean space In computer algorithms the elements of this space should be described by numbers. The branch of geometry describing the elements of space by numbers is the analytic geometry. The basic concepts of analytic geometry are the vector and the coordinate system.

Definition 22.1 A vector is a translation that is defined by its direction and length. A vector is denoted by .

The length of the vector is also called its absolute value, and is denoted by . Vectors can be added, resulting in a new vector that corresponds to subsequent translations. Addition is denoted by . Vectors can be multiplied by scalar values, resulting also in a vector (), which translates at the same direction as , but the length of translation is scaled by .

The dot product of two vectors is a scalar that is equal to the product of the lengths of the two vectors and the cosine of their angle:

Two vectors are said to be orthogonal if their dot product is zero.

On the other hand, the cross product of two vectors is a vector that is orthogonal to the plane of the two vectors and its length is equal to the product of the lengths of the two vectors and the sine of their angle:

There are two possible orthogonal vectors, from which that alternative is selected where our middle finger of the right hand would point if our thumb were pointing to the first and our forefinger to the second vector (right hand rule). Two vectors are said to be parallel if their cross product is zero.

22.1.1. 22.1.1 Cartesian coordinate system

Any vector of a plane can be expressed as the linear combination of two, non-parallel vectors , in this plane, that is

Similarly, any vector in the three-dimensional space can be unambiguously defined by the linear combination of three, not coplanar vectors:

Vectors , , are called basis vectors, while scalars are referred to as coordinates. We shall assume that the basis vectors have unit length and they are orthogonal to each other. Having defined the basis vectors any other vector can unambiguously be expressed by three scalars, i.e. by its coordinates.

A point is specified by that vector which translates the reference point, called origin, to the given point. In this case the translating vector is the place vector of the given point.

The origin and the basis vectors constitute the Cartesian coordinate system, which is the basic tool to describe the points of the Euclidean plane or space by numbers.

The Cartesian coordinate system is the algebraic basis of the Euclidean geometry, which means that scalar triplets of Cartesian coordinates can be paired with the points of the space, and having made a correspondence between algebraic and geometric concepts, the theorems of the Euclidean geometry can be proven by algebraic means.

Exercises

22.1-1 Prove that there is a one-to-one mapping between Cartesian coordinate triplets and points of the three-dimensional space.

22.1-2 Prove that if the basis vectors have unit length and are orthogonal to each other, then .