# Just a button

I sincerely hope the orange menace will lose the upcoming election.

I sincerely hope the orange menace will lose the upcoming election.

This article contains my reading notes from the third chapter of the book 3D Math Primer for Graphics and Game Development, 2nd edition. The subject of the chapter is Multiple Coordinate Systems.

The reason multiple coordinate spaces are used is that certain pieces of information are known only in the context of a particular reference frame. It might be true that theoretically all points could be expressed using a single " "world" coordinate system. However, for a certain point a, we may not know the coordinates of a in the "world" coordinate system. But we may be able to express a relative to some other coordinate system.

The world coordinate system is a special coordinate system that establishes the “global” reference frame for all other coordinate systems to be specified.

Object space is the coordinate space associated with a particular object. Every object has its own independent object space. When an object moves or changes orientation, the object coordinate space associated with that object is carried along with it, so it moves or changes orientation too.

One especially important example of an object space is camera space, which is the object space associated with the viewpoint used for rendering. Note carefully the differences between camera space, which is a 3D space, and screen space, which is a 2D space. The mapping of camera-space coordinates to screen-space coordinates involves an operation known as projection.

When communicating either to human beings via words or to computers via code, it is helpful to associate with each object a new coordinate space, which we call the upright coordinate space of the object. An object’s upright space is, in a certain sense, “halfway” between world space and its object space. The axes of upright space are parallel with the axes of world space, but the origin of upright space is coincident with the origin of object space.

Why is upright space interesting? To transform a point between object space and upright space requires only rotation, and to transform a point between upright space and world space requires only a change of location, which is usually called a translation. Thinking about these two things independently is easier than trying to cope with them both at once.

Do we have to rotate first, and then translate? The answer to this question is basically yes. Although it may seem more natural to translate before rotating, it’s usually easier to rotate first. Here’s why. When we rotate the object first, the center of rotation is the origin. Rotation about the origin and translation are two primitive tools we have at our disposal, and each is easy.

Specifying the position of the coordinate space is straightforward. All we have to do is describe the location of the origin. We do this just like we do for any other point. Of course, we must express this point relative to the parent coordinate space, not the local child space. The origin of the child space, by definition, is always (0, 0, 0) when expressed in child coordinate space.

Specifying the orientation of a coordinate space in 3D is only slightly more complicated. The axes are vectors (directions), and can be specified like any other direction vector. Just as with position, we do not use the object space itself to describe the object-space axis directions, since those coordinates are [1, 0] and [0, 1] by definition. Instead, the coordinates are specified in upright space.

This article contains my reading notes from the second chapter of the book 3D Math Primer for Graphics and Game Development, 2nd edition. The subject of the chapter is Vectors, and the chapter starts with the basic properties of vectors. Below I have noted some important (to me) definitions.

As the subject of the book is graphics, the coverage is focused on the geometric interpretations of vectors and vector operations. Geometrically speaking, a vector is a directed line segment that has *magnitude* and *direction*.

For any given vector dimension, there is a special vector, known as the zero vector, that has zeroes in every position. The zero vector has zero magnitude, and no direction. Think of the zero vector as a way to express the concept of "no displacement", much as the scalar zero stands for the concept of "no quantity". Below is the three-dimensional zero vector:

\[ \boldsymbol{0} = \begin{bmatrix} 0 \\ 0 \\ 0 \\ \end{bmatrix} \]

It is important to understand that points and vectors are conceptually distinct, but mathematically equivalent. When you think of a location, think of a point and visualize a dot. When you think of a displacement, think of a vector and visualize an arrow. The math we develop in the following sections operates on "vectors" rather than "points". Keep in mind that any point can be represented as a vector from the origin.

Negating a vector results in a vector of the same magnitude but opposite direction. We negate a vector by negating each component of it, i.e.:

\[ - \begin{bmatrix} 2 \\ 2 \\ \end{bmatrix} = \begin{bmatrix} -2 \\ -2 \\ \end{bmatrix} \]

A vector can be multiplied by a scalar, and this will change the magnitude of the vector, and possibly the direction as well.