<<

Discrepancies between euclidean three-dimensional space and the modeled by means of homogeneous coordinates accountfor seemingly paradoxical phenomena in . 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 (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 , , 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 ,

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 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. If one wanted to define a topology of the extended plane such that the position of Q is always a continuous function of 0, one would define the infinite points at the ends of a line to be the same point. This, as we will see, leads to thecon- struction of the projective plane. There are many popular ways to characterize the pro- jective plane. For background we will present some vary- ing descriptions here and then illustrate their equivalence. The well-known Moebius band is constructed by pasting together the ends of a half-twisted strip of paper. This is schematically depicted in Figure 5a. Among other interesting topological properties, the Moebius band has only one edge and one side. Now consider the ob- tained by "sewing" together the edge of the Moebius band and the edge of a disk so that points p and q on the disk coincide with the same points on the band (Figure 5b). Some physical experimentation quickly reveals that this construction is not realizable in ordinary E3 space, although we can certainly imagine it by allowing the sur- faces to pass through each other in our minds (or in E4).

Definition 3: The surface p2 that we have constructed Figure 5. Schematic illustration of Moebius band (a); join- from the shapes in Figure 5b is a projective plane. While it ing points p and q on the band and the disk (b) produces a looks like the euclidean plane E2 in the small, it clearly is projective plane. not, globally, for it cannot be embedded in E3.

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. With less material and more imagination we can arrive at the following equivalent description, by considering the effect of allowing the width of the Moebius band in the previous construction to shrink. Setting the width at zero results in a construction that is the same as the unit disk except that antipodal points on the circumference are identified.

Definition 4: The common description given above and portrayed in Figure 6 is the projective plane p2.

Definition 5: Alternatively, the projective plane p2 is a solid unit ball in E3 with the origin removed and with the imposed identification that all points on any given diameter are the same points. Analytically stated, Definition 5 says that the equiva- lenceclass X(a,b,c):X .Oforfixed(a,b,c) . (0,0,0)isa single point of the projective plane. Clearly we can let (a,b,c) be outside the unit sphere since all points not equal to the origin on any diameter are being identified as Figure 6. When the width of the Moebius band is zero, the one point. But this identification is exactly the conven- result is the projective plane with antipodal points on the tion, detailed in the previous pages, that is used in com- circumference identified. puter graphics. We'll pursue the importance ofthis obser- vation at the conclusion of this article. We must get from Definition 4 to Definition 6 with To show the equivalence of Definitions 4 and 5 requires transformations that preserve topological integrity- a briefargument. First we coordinate the points in E3 with namely, homeomorphisms. A homeomorphism is a con- polar coordinates (p,O, ), where p . 0 is the modulus, the tinuous, one-to-one, onto function whose inverse is also longitudinal angle 0-0-2ir is measured counter- continuous. First we divide s2 at the equator into two clockwise from the positive x-axis, and - (7r/2) csOs 7x/2 hemispheres (see Figure 7a): S+ = 1(0, ): 0 .k c 7r/2 J and is the latitudinal angle above or below the (x,y) -plane. S_ = [(O,O): - (7/2) -4 -OJ. Formally stated, Definition The radial projection (p,O,)-(l,O,) maps the punc- 6 requires that the points (0,ck) and (O +7, -4) be con- tured (without the origin) ball in E3 to S2, the sphere of sidered the same point. We are permitted to cut S2 at the unit radius. Thus we arrive at a new, intermediate defini- equator, rotate S by 0 = - ir, and glue it back to S+, for tion. on the equator we have combined the point (0,0) with (0+ r,O). This brings us to the state of affairs depicted in Definition 6: The projective plane is obtained from s2 Figure 7b, where antipodal points on the equator of S2 are by identifying antipodal points. still identified, while points (0,4)) and (0, - )) off the

Figure 7. Separated hemispheres (a) with identified antipodal points P and P', and rotated and rejoined hemispheres (b) showing identification of points P and P'.

January 1981

Authorized licensed use limited to: Sogang University Loyola Library. Downloaded on August 25, 2009 at 12:24 from IEEE Xplore. Restrictions apply. equator are considered the same. Since (0,k) and (0, k) tification is the unit disk whose boundary (the equator) is off the equator are the same point, we can represent it by constrained by the identification of opposite points, or the single point (r,0) in the (x,y)-plane, where r = cos¢. Definition 4. In rectangular coordinates, this projects both points Finally, we cite from Hilbert and Cohn-Vossen4 (p. (x,y,z), (x,y, -z) + (x,y). The image of this last iden- 340) a programmable, analytical description for genera- ting a surface in E4 that is topologically equivalent to the projective plane P3. A point (x,y,z,t) on the surface is given by x=u2 -V2,y=uv,z=uw, t=uw (1) subject to the constraint, u2+V2+ W2=1 While the proof that equation (1) is equivalent to the projective plane can be found in the book just cited, pic- tures of computer-generated projections of the four- dimensional surface are shown in Figure 8. The self- intersections result from the projection; they are not in- digenous to the actual surface. One can see in (c) that all radii emanating from the origin eventually return to the origin. The separation properties of topological spaces vary considerably.7 For example, in the euclidean plane E2, or in the surface of the sphere S2 in E3, a closed curve separates the surface into two distinct regions, the inside and the outside. In contrast, a torus, a frequently en- countered example, does not have the property whereby a closed curve necessarily separates the space, because there are two fundamental kinds of paths "around a torus": the C, around the outside, and the circle C2 passing through the hole (see Figure 9). The example in Figure 10 demonstrates that the projec- tive plane P2 has separation properties different from E2. The set of homogeneous points L, = [(I,I,t): I t -1I connecting the point P= (1,1,1) with P2=(1,l,-1)=- ( -1,-,1,) is a line segment through the origin. However, L2 = 1,1,t): I t c 1 is another line segment connecting P, and P2 without containing the origin; it contains the point at infinity (1,1,0). In other words, for t ranging free- ly over the reals, the homogeneous line L = [(- 1,1,t) 1, which is perpendicular to Li, does not separate P2, while the euclidean line L'=t( -l,1)+( -t)(1,-1) separates (1,1) from (1, -1) in particular and all of E2 in general.

C2

Figure 8. Computer-generated half-tone images of a four-dimensional surface equivalent to the projective plane P3: (a) the simple projec- tive plane, (b) the plane with textured surface, and (c) the plane with radii emanating from the origin (courtesy of J. Blinn, University of Utah). Figure 9. The two fundamental paths of a torus. 54 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. References

I . L.G. Roberts, "Homogeneous Matrix Representation and Manipulation of N-Dimensional Constructs," MS-1405, Lincoln Laboratory, MIT, May 1965. 2. J.F. Blinn and M.E. Newell, "Clippings Using Homogene- ous Coordinates," Proc. Siggraph '78, pp. 245-251. 3. W.M. Newman and R.F. Sproull, Principles ofInteractive Computer Graphics, McGraw-Hill, 1973 (2nd ed., 1979). 4. D. Hilbert and S. Cohn-Vossen, Geometry and the Im- agination, Chelsea Publishing Co., New York, 1952. 5. S.A. Coons, SurfacesforComputerAided Design ofSpace Forms, MIT Project MAC TR41, June 1967. 6. S.A. Coons, "Matrices and Transformations," notes for University of Michigan summer course on computer graphics, 1969. 7. R. Courant and H. Robbins, What Is Mathematics? Ox- ford University Press, 1941. Figure 10. This example shows that p 2 has separation pro- 8. A.R. Forrest, "Coordinates, Transformations, and Vi- perties different from E2. sualization Techniques," Computer Aided Design Group Doc. No. 23, University of Cambridge, June 1969. 9. J. Hinds, "Sculptured Surfaces," notes for CAD tutorial, By juxtaposing a description of homogeneous coor- Siggraph '80. dinates as used in computer graphics with a topological description of projective planes, this article has Richard F. Riesenfeld is an associate pro- documented their equivalence. The ostensibly benign fessor of computer science at the Universi- ty of Utah, where he joined the faculty in conventions imposed in the use of homogeneous coordi- 1972. Computer-aided geometric design nates effectively convert E3 to the projective plane P3. and computer graphics are his research Although they may seem interchangeable locally, these specialties. Riesenfeld received the PhD spaces exhibit significantly different separation properties. degree from the School of Computer and A = Information Science at Syracuse Universi- single plane like z 0 does not separate P3 as it does E3, I * - In 1973. so clipping algorithms must take this into account.2 A com- _l ~ty puter graphics user who thinks that he is modeling E3 may encounter mysterious ambiguities over different line seg- ments connecting the same two points in P3. The mystery is satisfactorily solved if we recognize that computer graphics attempts to model E3 by using P3. A person who wants to develop an algorithm using homogeneous coordinates for computer graphics should be aware ofthe discrepancies be- tween the two realms, lest he risk anomolous behavior of the algorithm caused by lines passing through infinity and returning behind the viewer. -

Tutorial: Computer Graphics Acknowledgments Kellogg S. Booth Serving as an introductory course in computer graphics, this tutorial addresses fundamental I am grateful for I.E. Sutherland's suggestion that I issues in hardware and software, with an empihasis write this article. Conversations with J.F. Blinn, S.A. on decision-making in the acquisition, imple- Coons, A.R. Forrest, and M.E. Newell were very helpful. mentation and use of these systems. Topics in- clude hardware for plotters, line-drawing CRTs, E. Cohen made substantial contributions to the article master video, and input devices; software for com- during its preparation. The artwork by J. Pugh, the munications, display primitives, transformations, computer-generated illustrations by J. Blinn, and the slipping, perspectives, data structures, and hidden- line/hidden-surface removal; commercial and turn- computer-generated drawings by R. Elens are excellent key systems, and graphics standards. Examples of aids to the reader. applications in engineering, research, education This work was supported in part by the National and film making are included. Amply illustrated in Science Foundation under grant MSC-74-13017-AOI. full color. Contains 39 reprints. Non-members: S28.00 Members: $21.00 438 pp. Order #233 January 1981 Use order form on pg. 104C.

Authorized licensed use limited to: Sogang University Loyola Library. Downloaded on August 25, 2009 at 12:24 from IEEE Xplore. Restrictions apply.