Homogeneous Coordinates
Homogeneous Coordinates
notes were originally scribed when the course was offered in 1991
4X-6Y=2
2
2X-3Y=5
1/2
-3
-2
-1
-1/3 -1
2.5
-5/3 -2
Figure 1: Example 1 y = dc with a = 0, we can choose c = 1/a and get w = 1. The resulting solution [w; x, y] = [1; b/a, d /a] of the homogenized system corresponds to the point (b/a, d /a) in the afne plane. In this course we use column vectors to represent points. To remind ourselves of that, we use square brackets to represent points and angled brackets to represent lines (which are row vectors). Another example: Lets consider the following pair of equations: X +Y = 2 X Y = 0 We can homogenize the equations to obtain: x + y = 2w x y = 0w The solution of this system of equations is w=c
for any real number c. If we want to make w = 1, we can choose c = 1, getting [w; x, y] = [1; 1, 1]. When the afne system has a solution, the homogenized, linear system has a solution with w = 1. In this course, we will often use homogenization to convert afne equations and system into linear equations and systems. afne equations homogenize linear equations.
We are now going to study how homogeneous coordinates help us in our work with algebraic geometry (see Figure 2). Lets consider the intersection between the curve XY = 1 and several other curves. The rst case is the intersection with the line X + Y = 5 2 we have: Y= 5 X 2
5 X( X) = 1 2 5 0 = X2 X + 1 2 0 = (X 2)(X 1/2) In this case we have two distinct, real roots. The second case is the intersection with the line X + Y = 2, we have: X +Y = 2 Y = 2X X (2 X ) = 1 0 = X 2 2X + 1 0 = (X 1)(X 1) In this case we have two equal real roots, that is, a double root. The third case is the intersection with the line X + Y = 0, we have: X +Y = 0 Y = X X (X ) = 1 0 = X2 + 1
X+Y=5/2
5 4 3 2 1
X=1
XY=1
6 1 2 3 4 5
-6
-5
-4
-3
-2
-1 -1
XY=1
-2 -3 -4
X+Y=2
-5
X+Y=0
Figure 2: Example 2 0 = (X + i)(X i) In this case we have two distinct, complex roots. The fourth case is the intersection with the line X = 0. If we proceed naively, we have X = 0w XY = 1 0Y = 1 0=1
This implies that w = 0 is a double root. When w = 0, we also have x = 0 by assumption. But we cant also have y = 0, or we would be in the illegal case of having all three homogeneous coordinates equal to 0. So we must have y = 0, say y = 1. Thus, the hyperbola intersects the line X = 0 twice at the point [w; x, y] = [0; 0, 1], the point at innity in the vertical direction. In fact, the line X = 0 is the tangent line to the hyperbola XY = 1 at the point [0; 0, 1]. The fth case is the intersection with the line X = 1. In this case, we once again homogenize the equations: x=w xy = w2 wy = w2 0 = w2 wy 0 = w(w y) 0 = (w 0)(w y) So we have two points of intersection, one with w = 0 and the other with w = y. When w = 0, we have x = 0 also, so, as in the fourth case, we must have y = 0 and the resulting point is [w, x, y] = [0; 0, 1], the point at innity in the vertical direction. When w = y, we also have x = w, so the resulting point is [w, x, y] = [1; 1, 1], the nite point whose Cartesian coordinates are (1, 1). This example shows how problems that have no solution in the afne plane can have solutions in the projective plane, which we can locate by using homogeneous coordinates. In fact, if we count multiple roots properly and count complex roots and count roots at innity, then any two plane curves, one of degree m and the other of degree n, either intersect in precisely mn points or in innitely many points (Bzouts Theorem). Thus, the projective approach provides the right number of solutions for each problem and all those solutions can be expressed in the same form, avoiding any need for exceptions or special cases. As a result, algorithms can be coded with fewer separate cases and things are generally more elegant. We convert a point expressed in Cartesian coordinates to homogeneous coordinates by adding w = 1 as the additional, weight coordinate. In the plane, we have (X , Y ) Cartesian = [1; X , Y ] Homogeneous and in space, we have (X , Y, Z ) Cartesian = [1; X , Y, Z ] Homogeneous.
Figure 3: Line in site space that represents the point (2) = [2, 1]. Of course, we can also multiply all of the homogeneous coordinates by any nonzero scalar without changing the corresponding point. So it is equally valid, say in the plane, to take (X , Y ) Cartesian = [w; X w, Y w] Homogeneous for any nonzero w. In the special case of w = 1, the resulting homogeneous coordinates are called normalized. We convert from homogeneous coordinates to Cartesian coordinates by the following rule: [w; x, y] and w = 0 = (X , Y ), where X = for 2-dimensions, and [w; x, y, z] and w = 0 = (X , Y, Z ), where X = y z x , Y = , and Z = w w w y x and Y = w w
for 3-dimensions (see Figure 3 for a picture of how this projection works when going from a point in projective 1-space, written in homogeneous coordinates, to the corresponding point in afne 1-space, written in Cartesian coordinates). The homogeneous points with w coordinate equal to 0 are points at innity. For example, [0; 1, 3] is the point at innity with direction (1, 3) and [0; 2, 4, 5] is the point at innity with direction (2, 4, 5).
This condition exactly characterizes the line joining P1 and P2 and therefore expanding the above determinant gives the equation of the line. Hence the homogeneous coordinates of the line l are, x1 y2 y1 x2 ; y1 w2 w1 y2 , w1 x2 x1 w2
Figure 4: The spherical model of the projective plane P2 Similarly, given the homogeneous coefcients for two lines, we can compute the homogeneous coordinates of the intersection point. Suppose l1 = a1 ; b1 , c1 l2 = a2 ; b2 , c2 A third line l = a; b, c is concurrent with l1 and l2 if and only if the determinant a b c a1 b1 c1 a2 b2 c2 =0
The homogeneous coordinates (w; x, y) of the point of intersection are given by expanding the above determinant. Hence, the homogeneous coordinates of the point are, (b1 c2 b2 c1 ; a2 c1 a1 c2 , a1 b2 a2 b1 ) In projective space, we work with lines through the origin instead of points, and planes through the origin instead of lines. But, to keep the terminology simple, we continue using the words point for a line through the origin of site space. line for a plane through the origin of site space. At this point Prof. Guibas talked abut the different models of the projective plane, especially the straight model and the spherical model, and also talked about the topology of the projective plane (see Figure 4).
Rotation Part
Translation Part
10
Q1
XY=1 S1
Q2 S2
R1
P1
R2
P2
top-left element isnt 0, we can normalize the matrix to make its top-left element be 1. When the matrix represents an afne map, we always normalize it in this way.)
11
The condition [M ][P1] = [P2 ] tells us that a d g 0 d 0 b e h 1 = e = 1 , c f i 0 f 0 so we must have d = 0 and f = 0. a b c Similarly, the condition [M ][R1] = [R2 ] tells us that d g 1 a 1 e h 0 = b = 0 , f i 0 c 0
so we must have b = 0 and c = 0. The condition [M ][Q1 ] = [Q2 ] is a bit more complicated: a d g 0 g 1 b e h 0 = h = 0 c f i 1 i 2 tells us that h = 0 and that i = 2g. So far, we have deduced that the matrix M must have the form a 0 g M = 0 e 0 . 0 0 2g But we still dont know the ratios a : e : g. By determining these nal ratios properly, we can arrange that [M ][S1] = [S2 ]: a 0 g 1 a+g 1 0 e 0 1 = e = 1 0 0 2g 1 2g 1 That is, we want a + g = e = 2g. One easy way to achieve this is to let a = 1, e = 2, and g = 1. The resulting projective map M is 1 0 1 M = 0 2 0 . 0 0 2 This projectivity M maps Q1 to Q2 and R1 to R2 , so it maps the Y -axis to itself. It turns out that it maps the hyperbola XY = 1 to a hyperbola with the lines Y = 0 and Y = X + 4 as its asymptotes. This new hyperbola is tangent to the Y -axis (the line X = 0) at the point Q2 .
12
References
[Foley 90] J.D. Foley, A. van Dam, S.K. Feiner, J.F. Hughes. Computer Graphics. Principles and Practice, Addison-Wesley Publishing Company, Appendix: Mathematics for Computer Graphics: 1083-1112, 1990. [Stol 91] J. Stol, Oriented Projective Geometry. A framework for Geometric Computations, Academic Press, First Edition. Chapter 1. Projective geometry: 3-11, 1991