0% found this document useful (0 votes)
225 views12 pages

Homogeneous Coordinates

This document discusses homogeneous coordinates and how they are used in geometric modeling and computer graphics. It provides examples of how homogenizing equations allows solutions that were not possible in the affine plane, such as finding the point of intersection of two lines that are parallel in the affine plane. It also discusses how homogeneous coordinates are used to represent points and lines and how to convert between homogeneous and Cartesian coordinates. Projective transformations and their representation by matrices are also introduced.

Uploaded by

Anonymous nec4te
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
225 views12 pages

Homogeneous Coordinates

This document discusses homogeneous coordinates and how they are used in geometric modeling and computer graphics. It provides examples of how homogenizing equations allows solutions that were not possible in the affine plane, such as finding the point of intersection of two lines that are parallel in the affine plane. It also discusses how homogeneous coordinates are used to represent points and lines and how to convert between homogeneous and Cartesian coordinates. Projective transformations and their representation by matrices are also introduced.

Uploaded by

Anonymous nec4te
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

CS348a: Computer Graphics Geometric Modeling Stanford University Original Lecture #2: Topics: Scribe: 5 October 1993 Homogeneous

Coordinates Arturo Puente

Handout #15 Original Handout #4 Tuesday, 12 October 1993

1 Why homogeneous coordinates?


Some of the reasons for working with homogeneous coordinates were mentioned by Stol [Stol 91]: Simpler formulas Fewer special cases Unication and extension of concepts Duality Lets start with an example (see Figure 1). The two afne equations 2X 3Y = 5 4X 6Y = 2 represent two parallel lines, which do not intersect in the afne plane. But, if homogenize both equations, we obtain 2x 3y = 5w 4x 6y = 2w and this system has the following family of solutions w=0 x = 3c y = 2c for any real number c. This solution represents the point at innity [0; 3, 2] in the direction of the vector (3, 2). If the solution of the homogenized system is of the kind w = ac x = bc
these

notes were originally scribed when the course was offered in 1991

CS348a: Handout #15

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

CS348a: Handout #15


x=c y=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

CS348a: Handout #15

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

CS348a: Handout #15


but that doesnt make sense. Instead, we rst homogenize the equations, getting: x=0 xy = w2 0 = w2 0 = (w 0)(w 0)

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.

CS348a: Handout #15

[2k,k] k>0 [2,1] w=1 1 2 3 4 5

A point in affine space is a line through origin. [2k,k] k<0

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).

CS348a: Handout #15

1.1 Equation of a line in homogeneous coordinates


The equation of a line in Cartesian coordinates is: Y = mX + b where m is the slope and b is the Y -intercept, that is, the value of Y when X = 0. In the case of homogeneous coordinates, we associate with a line three homogeneous coefcients. These coefcients are calculated so that a; b, c = {[w; x, y] | aw + bx + cy = 0} Given a line equation Y = mX + b in slope-intercept form, we can rewrite that equation as b + mX Y = 0 so the homogeneous coefcients of that line are a; b, c = b; m, 1 . The homogeneous coefcients of the line at innity are 1; 0, 0 .

1.2 Homogeneous line dened by two points


Suppose that we have two points dened in homogeneous coordinates P1 = [w1 ; x1 , y1 ] P2 = [w2 ; x2 , y2 ] and that we want the homogeneous coefcients of the line l that joins P1 to P2 . Consider a third point P = [w; x, y] Let us characterize the condition under which P lies on l . If P1 , P2 , and P are collinear, then the triangle dened by the three points has zero area. Using the determinant formula for the area of a triangle, this condition can be rewritten as, w x y w1 x1 y1 w2 x2 y2 =0

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

CS348a: Handout #15

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).

CS348a: Handout #15


Projection Part

Rotation Part

Translation Part

Figure 5: Components of a projective transformation matrix

2 Matrices for linear, afne, and projective transformations.


An afne map of the plane has 6 degrees of freedom. One way to specify such a map is by giving three points in the domain (non-collinear) and specifying where each of those three points goes in the range. Similarly, an afne map of 3-space can take any four points (noncoplanar) to any four points. Projective maps have more freedom. A projective map of the plane can take any four points, no three collinear, to any other four points, no three collinear. A projective map of space can take any ve points, no four coplanar, to any other ve points, no four coplanar. Another way to think of a projective map, or projectivity, is as the composition of some number of perspectivities, where a perspectivity is the mapsay, from one plane to another that results from looking from some vantage point through one plane at the other plane. The composition of two perspectivities is not necessarily a perspectivity. But any composition of perspectivities is a projectivity. Both afne and projective maps of the plane can be represented as 3-by-3 matrices, and both afne and projective maps of 3-space can be represented as 4-by-4 matrices. The matrix that represents a projective map can be divided into several submatrices, which are responsible for the different components of the transformation. We can identify three major parts, as shown in Figure 5: the rotation component, the translation component, and the projection component. The matrix represents an afne map precisely when the projection component is all zeros, that is, when the rst row of the matrix is (1, 0, 0, . . ., 0). (Figure 5 shows a 1 in the top-left corner of the matrix. If the matrix represents a projective map, we can multiply all of the matrix elements by any common, nonzero scalar without changing anything. Thus, as long as the

10

CS348a: Handout #15

Q1

XY=1 S1

Q2 S2

R1

P1

R2

P2

Figure 6: A projective map of the hyperbola XY = 1

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.)

3 An example of a projective map


Lets nd a projective map that allows us to see the intersection point Q1 of the hyperbola XY = 1 with the line X = 0. In particular, lets move the point Q1 = [0; 0, 1], which is the point at innity in the vertical direction, to the nite point Q2 = [1; 0, 2]. While we move Q1 to Q2 , lets keep xed the following three other points: the point P1 = [0; 1, 0], the point at innity in the horizontal direction; the point R1 = [1; 0, 0], the origin; and the point S1 = [1; 1, 1]. That is, lets make P2 = P1 , R2 = R1 , and S2 = S1 . (See gure 6). Recall that a projective map of the plane can take any four points, no three collinear, to any other four points, no three collinear; so what we want to do makes sense. All that we start out knowing is that our projective map is represented by some 3-by-3

CS348a: Handout #15


matrix, say M : a d g M = b e h c f i

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

CS348a: Handout #15

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy