Page 86 - Computer Graphics Handout
P. 86
Chapter 3
GEOMETRIC OBJECTS AND TRANSFORMATIONS
We are now ready to concentrate on three-dimensional graphics. Much of this chapter is concerned with such matters as how
to represent basic geometric types, how to convert between various representations, and what statements we can make about
geometric objects independent of a particular representation.
We begin with an examination of the mathematical underpinnings of computer graphics. This approach should avoid much of the
confusion that arises from a lack of care in distinguishing among a geometric entity, its representation in a particular reference
system, and a mathematical abstraction of it. We use the notions of affine and Euclidean vector spaces to create the necessary
mathematical foundation for later work. One of our goals is to establish amethod for dealing with geometric problems that is
independent of coordinate systems. The advantages of such an approach will be clear when we worry about how to represent the
geometric objects with which we would like to work. The coordinate-free approach will prove to be far more robust than one based
on representing the objects in a particular coordinate system or frame. This coordinate-free approach also leads to the use of
homogeneous coordinates, a system that not only enables us to explain this approach but also leads to efficient implementation
techniques. We use the terminology of abstract data types to reinforce the distinction between an object and its representation.
Our development will show that the mathematics arise naturally from our desire to manipulate a few basic geometric objects.
Much of what we present here is an application of vector spaces, geometry, and linear algebra. Appendices B and C summarize the
formalities of vector spaces and matrix algebra, respectively. In a vein similar to the approach we took in Chapter 2, we develop a
simple application program to illustrate the basic principles and to see how the concepts are realized within an API. In this chapter,
our example is focused on the representation and transformations of a cube. We also consider how to specify transformations
interactively and apply them smoothly. Because transformations are key to both modeling and implementation, we will develop
transformation capabilities that can be carried out in both the application code and in the shaders.
3.1 SCALARS, POINTS, AND VECTORS
In computer graphics, we work with sets of geometric objects, such as lines, polygons, and polyhedra. Such objects exist in a three-
dimensional world and have properties that can be described using concepts such as length and angles. As we discovered working
in two dimensions, we can define most geometric objects using a limited set of simple entities. These basic geometric objects and
the relationships among them can be described using three fundamental types: scalars, points, and vectors. Although we will
consider each type from a geometric perspective, each of these types also can be defined formally, as in Appendix B, as obeying a
set of axioms. Although ultimately we will use the geometric instantiation of each type, we want to take great care in distinguishing
between the abstract definition of each entity and any particular example, or implementation, of it. By taking care here, we can
avoid many subtle pitfalls later. Although we will work in three-dimensional spaces, virtually all our results will hold in n-dimensional
spaces.
3.1.1 Geometric Objects
Our fundamental geometric object is a point. In a three-dimensional geometric system, a point is a location in space. The only
property that a point possesses is that point’s location; a mathematical point has neither a size nor a shape. Points are useful in
specifying geometric objects but are not sufficient by themselves. We need real numbers to specify quantities such as the distance
between two points. Real numbers—and complex numbers, which we will use occasionally—are examples of scalars. Scalars are
objects that obey a set of rules that are abstractions of the operations of ordinary arithmetic. Thus, addition and multiplication are
defined and obey the usual rules such as commutivity and associativity. Every scalar has multiplicative and additive inverses, which
16
implicitly define subtraction and division. We need one additional type—the vector—to allow us to work with directions .
16
The types such as vec3 used by GLSL and that we have used in our classes are not geometric types but rather storage types. Hence, we can use a vec3
to store information about a point, a vector, or a color. Unfortunately, the choice of names by GLSL can cause some confusion.
86

