2.1 Coordinate Systems
As is typical in computer graphics, pbrt represents three-dimensional points, vectors, and normal vectors with three coordinate values: , , and . These values are meaningless without a coordinate system that defines the origin of the space and gives three linearly independent vectors that define the , , and axes of the space. Together, the origin and three vectors are called the frame that defines the coordinate system. Given an arbitrary point or direction in 3D, its coordinate values depend on its relationship to the frame. Figure 2.1 shows an example that illustrates this idea in 2D.
In the general -dimensional case, a frame’s origin and its linearly independent basis vectors define an -dimensional affine space. All vectors in the space can be expressed as a linear combination of the basis vectors. Given a vector and the basis vectors , there is a unique set of scalar values such that
The scalars are the representation of with respect to the basis and are the coordinate values that we store with the vector. Similarly, for all points , there are unique scalars such that the point can be expressed in terms of the origin and the basis vectors
Thus, although points and vectors are both represented by , , and coordinates in 3D, they are distinct mathematical entities and are not freely interchangeable.
This definition of points and vectors in terms of coordinate systems reveals a paradox: to define a frame we need a point and a set of vectors, but we can only meaningfully talk about points and vectors with respect to a particular frame. Therefore, in three dimensions we need a standard frame with origin and basis vectors , , and . All other frames will be defined with respect to this canonical coordinate system, which we call world space.
2.1.1 Coordinate System Handedness
There are two different ways that the three coordinate axes can be arranged, as shown in Figure 2.2. Given perpendicular and coordinate axes, the axis can point in one of two directions. These two choices are called left-handed and right-handed. The choice between the two is arbitrary but has a number of implications for how some of the geometric operations throughout the system are implemented. pbrt uses a left-handed coordinate system.