Homogeneous Coordinates and Projective Planes in - Computer Graphics
Total Page:16
File Type:pdf, Size:1020Kb
Discrepancies between euclidean three-dimensional space and the projective space modeled by means of homogeneous coordinates accountfor seemingly paradoxical phenomena in computer graphics. Homogeneous Coordinates and Projective Planes in - Computer Graphics R. F. Riesenfeld University of Utah Relatively early in the history of computer graphics, for a single euclidean point. Augmenting (x,y,z) with a 1 is L.G. Roberts' suggested that homogeneous coordinates adequate for converting it to the equivalent homogeneous could be used to implement the most commonly required form (x,y,z, 1). Futhermore, varying h in (x,y,z,h) scales its transformations and projections. Since then, supported associated euclidean point (x*,y*,z*). Since any multiple of by S.A. Coons, I.E. Sutherland, and others, the tech- (x,y,z) can be used to represent the point at infinity (x,y,z,O) nique has become commonplace and is taught as part of in that direction, then (x,y,z,O) and (-x, -y, -z,O) repre- the standard computer graphics curriculum.3'5'6'8,9 sent the same point. This article analyzes how the technique works and Because of its conformability with 4 x 4 matrices discusses some of its topological implications. Failure to rather than the more restricted 3 x 3 matrices, the tech- recognize and understand these implications has led to nique of representing a point in E3 by an augmented vec- difficulties in clipping perspective pictures2; one aim of tor with four components has advantages. Before we see this discussion is to prevent similar difficulties in the what benefits are gained, however, let's be sure that no future. transformational power is lost to this device. We recall The most direct way to verify that the homogeneous from linear algebra that the set of 3 x 3 matrices coordinates method accomplishes the standard transfor- manifests the set of linear transformations on E3. Let M3 mations in computer graphics is to carry out the computa- be a 3 x 3 matrix representing a rotation, scaling, shear- tional conventions and examine their effects. Ifthe reader ing, or reflection of the point (x,y,z)eE3. Note that wishes to avoid performing the exercise, he will find it detailed in Newman and Sproull's3 discussion of (x,y,z) M3 - (x,y,z,J) M3 0 ' (1) representations and transformations. The following analysis of homogeneous coordinates consists of three 0 0 0 1 parts-algebraic, geometric, and topological. since the "homogeneous 1" is inert on the right-hand side of (1). Thus, we still can effect any linear transformation Algebraic aspects of homogeneous coordinates on E3. Exploring the elements of this larger transformation row holds the First, let's recall the basic rules for working in homoge- matrix, we discover below that the bottom neous coordinates. key to translation, Definition 1: When h . 0, (x,y,z,h) are the homogene- [X,Y,z, I] I3 0 =[X+txy+tyz+tzl], (2) ous coordinates for the ordinary point (xlh, y/h, zlh) in 0 ordinary, three-dimensional, euclidean space E3. The tx ty tzI point at infinity or ideal point in the direction (x,y,z) is given by the homogeneous representation (x,y,z,O). If where 13 is the 3 x 3 identity matrix. (x*,y*,z*) and (xy,z,h) are homogeneously related, we A standard viewing position, as shown in Figure 1, write (x*,y*,z*) (x,y,z,h). leads to the problem ofcalculating the proper coordinates Immediately we see that there is an infinitude of in the x-y plane for a "true perspective" view of (x,y,z) homogeneous representations X(x,y,z,h) = (XxX,y,Xz,Xh) with the eye located at (0,0, -p). This left-handed system 50 0272-1716/81/0100-0050$00.75 t 1981 IEEE IEEE CG&A Authorized licensed use limited to: Sogang University Loyola Library. Downloaded on August 25, 2009 at 12:24 from IEEE Xplore. Restrictions apply. transformations necessary for work in computer graphics, we will now interpret the geometric meaning of these homogeneous coordinate operations. To facilitate the visualization of these operations, we will study points in the augmented plane-the plane that includes the ideal points at infinity-and their relationship to the points in E3. Recall from Definition 1 that a homogeneous point is defined as a vector, v = (xh, yh, h), where h . 0 is ar- bitrary. Geometrically, this tells us that the vector in 3-space in the (positive or negative) direction (x,y, 1) is a representative of the point (x,y) in 2-space. Figure 2 shows the h = I plane in 3-space. That is, the point (x,y) is represented by the equivalence class Figure 1. A standard viewing position for computer (xh, yh, h): real h id O . (1) graphics-the x-y plane represents a CRT. In order to deal with points and lines as true dual elements of each other, we define the homogeneous line. has become rather conventional in computer graphics; the x-y plane corresponds to the face of a 2-D graphical Definition 2: A homogeneous line is the set of all (xh, output device like a cathode ray tube. yh, h) such that Similar triangles in each coordinate yield the answer (xh,yh,h)- (a,b,c)I=0. (2) (-a, P+py ) for the x-y coordinates of the perspective This homogeneous line is represented by -y = [a, b, c]'. view. Or, in matrix form, The set of (x, y, 1) such that -1 0 0 0- (x,y,z,1) 0 1 0 0 = (x,y,z,z/p + 1). (3) (x,y,l)- -y=ax+by+c=0 (3) O O O I/ forms the projected line. An inner product equal to zero, as in equation (2), in- And normalizing the homogeneous coordinate yields the dicates an orthogonal condition. Viewed geometrically in desired results in the first two coordinates, the 3-D embedding space, equation (2) defines the line -y pX py PZ as all the homogeneous (augmented, 2-D) points (xh,yh,h) perpendicular to the fixed vector (a, b,c). But that is the definition of the plane normal to (a,b,c) and Thus the fourth column contains the perspective factors passing through the origin shown in Figure 3. Moreover, of the x,y, and z-axis, respectively. we observe that under this convention, the projection of Geometric aspects of homogeneous coordinates Having algebraically verified that the 4 x 4 matrices operating on homogeneous points in E3 produce the Figure 2. The h =1 plane in 3-space and a projected point Figure 3. The line -y is represented as the intersection of a (xh, yh, h). fixed plane and a varying plane. January 1981 51 Authorized licensed use limited to: Sogang University Loyola Library. Downloaded on August 25, 2009 at 12:24 from IEEE Xplore. Restrictions apply. point v to be on the line -y. But now we look at the widely accepted notion that the sign of v -y indicates on which side of the line y the point v falls. Recall that v.*y = v -y cosO, where Ois the angle between v and-y. Referring to Figure 3, we notice that, for fixed -y, the points on one side ofthe line -y make an angle with (a,b,c) of less than Ir/2, and points on the other side make an angle greater than vr/2. Thus the sign of v * -y tells on what side ofthe line y the pointp lies. However, there is an am- - same Figure 4. The position Q can be made a continuous func- biguity inasmuch as -y and -y represent the line, but tion of the angle 0. they reverse the sign of v - y. So care must be taken that a consistent representation is used throughout a set of points being tested. the plane ax + by + ch = Oto the plane h = I is just the As an example of the utility of this representation, we line -y . ax+ by+ c = 0. Alternatively, the line note the ease with which we determine the intersection of = = I the line -y [a,b,c]' and a [d,e,f It. According to the -y = I (x,y, 1): (x,y, 1) -*(a,b,c) = °I. (3) homogeneous coordinate convention, the point that lies Having looked at this rather elaborate scheme for rep- on both the lines represented by -y and a is perpendicular resenting points and lines in space, we can now use this to both the vector -y and the vector S. Recall that the cross background to explain some seemingly serendipitous re- product y'e® 5' of two vectors yields a mutually perpen- lationships, which have been used to advantage in com- dicular third vector, which is precisely the intersection puter graphics. Already we have seen that v -y =0 is a point of lines y and S. necessary and sufficient condition for the homogeneous Topological aspects of the projective plane The following example demonstrates the usefulness of the topology ofthe projective plane. Let /be a line and Pa point off the line 1. Then another line m that passes through Pand is not parallel to lwill intersect Iat a point Q (see Figure 4). If m is rotated about P, observe that the position of Qis a continuous function ofthe angle 0. As m becomes parallel to 1, however, Q tends to infinity and there is no point of intersection Q. Then, as m is rotated more, Q reappears from the other direction.