Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the appendix entitled GNU Free Documentation License.

# Computer Graphics

In Computer Graphics, matrices are used to represent many different types of data. Games that involve 2D or 3D graphics rely on some matrix operations to display the game environment and characters in game. In this paper, the process of Linear Algebra in Computer Graphics is discussed with examples from different areas of Computer Graphics.

The first application of Linear Algebra can be seen in the polygonal structure of 3D characters and environment in computer games and other applications of 3D graphics. Polygons are used to make images appear three dimensional because of their geometric properties. Most of the time, this is done through dividing the object into smaller and smaller polygons where the smallest rendered parts are triangles. This makes generating 3D objects a part of the rendering process of the polygons. The simplest example of use of polygons in 3D graphics are in the form of wire frame models of objects. A 3D wireframe is a skeletal representation of a real world object. For example, a cube can be represented as an object with eight vertices connected through lines or wires to make it appear three dimensional.

• Rotation:
When dealing with 3D rotations you must take account to which axis you would like to perform the translation. Here is a rotation over the x-axis.
${\bf v} = \begin{pmatrix} v_1 \\ v_2 \\ v_3 \end{pmatrix} = \begin{bmatrix} 1&0&0 \\ 0& \cos\theta & -\sin\theta \\ 0&\sin \theta & \cos \theta \end{bmatrix} \begin{pmatrix} x\\ y\\ z \end{pmatrix} .$
Here is a rotation around the y-axis:
${\bf v} = \begin{pmatrix} v_1 \\ v_2 \\ v_3 \end{pmatrix} = \begin{bmatrix} \cos\theta & 0 & -\sin\theta \\ 0&1&0 \\ \sin \theta & 0 & \cos \theta \end{bmatrix} \begin{pmatrix} x\\ y\\ z \end{pmatrix} .$
Here is a rotation around the z-axis:
${\bf v} = \begin{pmatrix} v_1 \\ v_2 \\ v_3 \end{pmatrix} = \begin{bmatrix} \end{bmatrix} \cod \theta & -\sin\theta & 0 \\ \sin\theta & \cos \theta & 0 \\ 0&0^1 \begin{pmatrix} x\\ y\\ z \end{pmatrix} .$
• Scaling:
In certain instances it may be required that an object has to be resized on the same coordinate. The axes are then resized to different scales. As mentioned before to scale a 2D point in the x direction by Sx and in the y direction by Sy we require transforming it as:
$\left( x_2 , y_2 \right) = \left( S_x x_1 , S_y y_1 ) .$
To achieve this, we use a matrix representation of the form,
$\begin{pmatrix} x_2 \\ y_2 \end{pmatrix} = \begin{bmatrix} S_x & 0 \\ 0 & S_y \end{bmatrix} \begin{pmatrix} x_1 \\ y_1 \end{pmatrix}$
is required.

3D models have several uses in computer assisted design (CAD) for engineering purposes. Using advanced scanning techniques with the help of MRI, 3D models of organs can be created which can help diagnose and assist in treatments of patients. In other medical uses, 3D models of proteins can help cancer research. For this, the required computing power is gotten through computing projects such as FOLDING@HOME which simulates folding of proteins as well as other types of molecules. There are many 3D models that are often used in movies and TV shows to represent characters as well as objects such as Toy Story. These characters or objects can be made realistic with advanced modeling techniques.

The second process in 3D graphics is called animation. This process defines relationships between 3D objects in a three dimensional space over time. This can be done through many different methods such as key frames, inverse kinematics and motion capture. Motion capture is the modeling of a 3D animation by using sensors or cameras to capture the motion of an object or a person in the real world. Inverse kinematics is a powerful tool when developing games or movies that makes it possible to calculate the precise positions for a joint system so it will eventually reach a certain goal. This is done in movies to capture facial expressions of actors to be used in animation to depict those expressions on animated characters. For example, in Pirates of the Caribbean movie, Davy Jones facial expressions was modeled with his face tentacles in the movie with the help of motion capture of the actor’s face. Similarly, inverse kinematics is a process where the path of an object can be used by partial information or data from some other source. A known application of this process is in Robotics where this process is employed to calculate the trajectory needed for robot’s limb in order to successfully perform a maneuver or a task. Therefore this process requires a sophisticated application of Linear Algebra. If you look at the picture that was discovered on a recent blog you can see that Mario is jumping with a velocity of (1,3). You can see that he is moving pretty fast upwards and to the right with an acceleration of (0,-1). In the game the player normally uses an analog to control the left and right movement of the character. Then the player would press some sort of button for the character to jump. This is a perfect example to show you how games use vector addition and subtraction to calculate the overall velocity and position of the player.

The third process in 3D graphics is called 3D rendering. 3D rendering makes use of a 3D wire frame model of an object or multiple objects to produce an animated scene or a 2D image from the scene. This is done through the application of two operations. First operation is transport, which means how much light is being shone on to the surface being rendered, from what direction this light is coming, and how intense the light source is. The second operation is called scattering which determines how the surface is being rendered interacts with light. These two operations are required to render 3D models in CAD animation, or even physics and weather animations etc. Although in this animation setting, such as some video games, movies and advertisements, other sophisticated techniques such as god rays or scanline rendering are used to improve the quality.

In conclusion, Linear Algebra is used in many different ways in computer graphics. The mathematical structure of computer graphics takes advantage of many operations and theorems in Linear Algebra to assist in 2D/3D models, in animations and in rendering.

There are many uses for 3D wireframes such as viewing the model from any angle or even using it to analyze the distances between the edge and corners. This technique has been in use for almost as long as computer displays have been around. It became noticed in late 1970’s and early 1980’s when it was used in computer games. Around the same time, 3D object rendering started being used in movies to depict objects. Making of 3D graphics can be divided into the following different processes:

First is the modeling of a surface of an object into a representation of a collection of points in 3D space. This process is done with the help of a modeling software, or by using specialized 3D scanners. However, the end result is always a collection of points in 3D space. These points are vectors in Linear Algebra, on which the processes of Linear Algebra such as transformation, rotation and scaling can be applied.