Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Homogeneous Coordinates and Computer Graphics

Homogeneous Coordinates and Computer Graphics

Ratings: (0)|Views: 12 |Likes:
Published by gogi_ts

More info:

Published by: gogi_ts on Oct 31, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

10/31/2011

pdf

text

original

 
Homogeneous Coordinates andComputer Graphics
Tom Davis
tomrdavis@earthlink.nethttp://www.geometer.org/mathcirclesNovember 20, 2001The relationship between Cartesian coordinates and Euclidean geometry is well known. The theoremsfrom Euclidean geometry don’t mention anything about coordinates, but when you need to apply thosetheorems to a physical problem, you need to calculate lengths, angles, et cetera, or to do geometric proofsusing analytic geometry.Homogeneous coordinates and projectivegeometry bear exactly the same relationship. Homogeneous co-ordinates providea method for doingcalculations and provingtheorems inprojectivegeometry,especiallywhen it is used in practical applications.Although projective geometry is a perfectly good area of “pure mathematics”, it is also quite useful incertain real-world applications. The one with which the author is most familiar is in the area of computergraphics. Since it is almost always easier to understand mathematics when there are concrete examplesavailable, we’ll use computer graphics in this document as a source for almost all the examples.The prerequisites for the material contained herein include matrix algebra (how to multiply, add, andinvert matrices, and how to multiply vectors by matrices to obtain other vectors), a bit of vector algebra,some trigonometry, and an understanding of Euclidean geometry.
1 Computer Graphics Problems
We’ll beginthestudyofhomogeneouscoordinatesbydescribingasetofproblemsfromthree-dimensionalcomputer graphics that at first seem to have unrelated solutions. We will then show that with certain“tricks”, all of them can be solved in the same way. Finally, we will show that this “same way” is in fact just a recasting of the original problems in terms of projective geometry.
1.1 Overview
Much of computer graphics concerns itself with the problem of displaying three-dimensional objectsrealistically on a two-dimensional screen. We would like to be able to rotate, translate, and scale ourobjects, to view them from arbitrary points of view, and finally, to be able to view them in perspective.We would like to be able to display our objects in coordinate systems that are convenient for us, and to beable to reuse object descriptions when necessary.As a canonical problem, let’s imagine that we want to draw a scene of a highway with a bunch of carson it. To simplify the situation, we’ll have all the cars look the same, but they are in different locations,moving at different speeds, et cetera.We have the coordinates to describe a tire, for example, in a convenient form where the axis of the tire isaligned with the
 
-axis of our coordinate system, and the center of the tire is at
¡¢£¢£¢¤
. We would liketo use the same description to draw all the tires on a car simply by translating them to the four locationson the body. Our car body, of course, is also defined in a nice coordinate system centered at
¡¢£¢£¢¤
andaligned with the
 
,
¥
, and
¦
-axes.Once we get the tires “attached” to the body, we’d like to make multiple copies of the car in differentorientations on the road. The cars may be pointing in different directions, may be moving uphill anddownhill, and the one that was involved in a crash may be lying upside-down.1
 
Perhapswewanttoviewtheentirescenefromthepointof viewof atraffichelicopter thatcan beanywhereabove the highway in three-dimensional space and tilted at any angle.We’ll deal with the viewing in perspective later, but the first three problems to solve are how to translate,rotate, and scale the coordinates used to describe the objects in the scene. Of course we want to be ableto perform combinations of those operations
1
.We assumethat everyobject is described intermsof three-dimensionalcartesian coordinateslike
§¨©©
,and we will not worry how the actual drawing takes place. (In other words, whether the coordinates arevertices of triangles, ends of lines, or control points for spline surfaces—it’s all the same to us—we justtransform the coordinates and assume that the drawing will be dragged around with them.)Finally, except in the cases of rotation and perspective transformation, it is easier to visualize and ex-periment with two-dimensional drawings and the extension to three dimensions is obvious and straight-forward.
1.2 Translation
Translation is the simplest of the operations. If you have a set of points described in cartesian coordinates,and if you add the same amount to the
¨
-coordinate of every one, all will move by the same amount inthe
¨
-direction, effectively moving the drawing by that amount. Adding a positive amount moves to theright; a negative amount to the left.Similarly, additions of a constant value to the
or
-coordinate cause uniform translations in those direc-tions as well. The translations are independent and can be performed in any order, including all at once.If an object is moved one unit to the right and one unit up, that’s the same as moving it one unit up andthen one to the right. The net result is a motion of length
units to the upper-right.We can define a general translation operator
§¨©©
as follows:
!"!#§¨$©©&%'§¨(0)2(3)5(0)6©
where
)1
,
)4
, and
)6
are the translation distances in the directions of the three coordinate axes. They maybe positive, negative,or zero.
!"!#
is a function mapping points of three-dimensional space into itself.This
!"!#
has an inverse,
87$9!"!#%'7!7"!7#
which simply translates in the opposite directionsalong each coordinate axis. Clearly:
!"!#§7!7"!7#§¨$©©&% §¨A@3)15(0)8@B)45(3)C@B)6D(3)6E%'§¨$©©F
1.3 Rotation about an Axis
We’ll begin by considering a rotation in the
¨
-
plane about the origin by an angle
G
in the counter-clockwise direction. Clearly, all of the
-coordinates will remain the same after the rotation. We willdenote this rotation by
HA6!I
. The
subscript is because the rotation is, in fact, a rotation about the
-axis.Figure 1 shows how to obtain the equation for the rotation. We begin with a point
PQ%Q§¨$©
and wewish to find the coordinates of 
PCRS%'§¨R©R
which result from rotating
P
by an angle
G
counter-clockwiseaboutthe
-axis. Theequations aremosteasilyobtainedby usingpolarcoordinates, where
T8%'U¨VE(3V
is the distance from the origin to
P
(and to
PCR
) , and
W
is the angle the line connecting the origin to
P
makes with the
¨
-axis.As we can see in the figure,
¨X%YT&`abW
and
%YT&bcd5W
, while
¨SR%YT&`ab§W(0G
and
RS%YT&bcd$§W(0G
.
1
There is one other operation that can easily be performed called “shearing”, but it is not particularly useful. The generalhomogeneous transformations that we’ll discover also handle all the shearing operations seamlessly.
2
 
P = (x, y) = (r cos
φ
 , r sin
φ
)P = (x, y) = (r cos
φ
 , r sin
φ
)P’ = (x’, y’) = (r cos (
φ
+
θ
), r sin (
φ
+
θ
))P’ = (x’, y’) = (r cos (
φ
+
θ
), r sin (
φ
+
θ
))
φφθθ
Figure 1: Rotation about the
e
-axisUsing the addition formulas for sine and cosine, we obtain:
fghiphqsrtfu&vwxfy€3qiu&ƒ$fy€0qq rtfu&vwxy5vwx2„Bu&x‚ƒ5y5x‚ƒDSiu&vwxy5x‚ƒDC€0uƒ5yCvwxq rtfgCvwx2„3pDx‚ƒESigCx‚ƒDC€3pDvwxq…
Thus we obtain:
†A‡ˆ‰fg$ipieq&r'fgCvwx2„3pEƒDSigCx‚ƒDC€3pDvwxi eq…
(1)As was the case with translation, rotation in the clockwise direction is the inverse of rotation in thecounter-clockwise direction and vice versa:
†X$‘‡ˆ‰r†A‡ˆ‰
. It’s a good exercise to check this by applyingequation 1 and its inverse to a point
fgipq
.The equations for rotation about the
g
and
p
axes can be obtained similarly, and for reference, here are allthree equations together:
†A’ˆ‰fgipieq“rtfg$ipDvwx2„ ex‚ƒESipDƒDC€ evwxq
(2)
†A”ˆ‰fgipieq“rtfg5vwxC€ ex‚ƒDSi$pi&„Dg5x‚ƒDC€ evwxq
(3)
†A‡ˆ‰fgipieq“rtfg5vwx2„BpDx‚ƒDig5x‚ƒDC€0pDvwxSi eq…
(4)At first glance, it appears that we have made an error in the signs in equation 3 for the rotation aboutthe
p
-axis, since they are reversed from those for rotations about the
g
and
e
-axes. But all are correct.The apparent problem has to do with the fact that the standard three-dimensional coordinate system isright-handed—if the
g
and
p
-axes are drawn as usual on a piece of paper, we must decide whether thepositive
e
-axis is above or below the paper. We have chosen to place positive
e
values above the paper.A left-handed system, where the positive
e
-axis goes down, is perfectly reasonable, but the usual conven-tion is the other way, and the difference is that the signs in some operations are switched around. Thenormal orientation is called a “right-handed” coordinate system and the other, “left-handed”. Even if wehad used a left-handed system, the signs would not be the same throughout the equations 2-4; a differentset of signs would be flipped.Think of the orientation of a rotation as follows: to visualize rotation about an axis, put your eye onthat axis in the positive direction and look toward the origin. Then a positive rotation corresponds to acounter-clockwise rotation. We’ve done this with rotation about the
e
-axis—your eye is above the paperlooking down on a standard
g
-
p
coordinate system. But visualize the situation looking from the positive
p
and positive
e
directions in a right-handed coordinate system. Looking from the
g
direction, the
p
goesto the right and the
e
goes up, but looking from the positive
p
-axis, the
g
-axis goes to the
left 
, while the
e
-axis goes up.3

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->