D Trnsformions Compuer Grphics COMP 770 (6) Spring 007 Insrucor: Brndon Lloyd /6/07
Geomery Geomeric eniies, such s poins in spce, exis wihou numers. Coordines re nming scheme. The sme poin cn e descried y differen coordines. Boh vecors nd poins expressed y coordines, u hey re very differen Our pln. undersnd he hings. THEN ssocie coordines o hem. Tringle Rleigh- Durhm (50, 60) Go 7 miles souhwes /6/07
Sclr Field Definiion. A se S over which ddiion (+) nd muliplicion (. ) re closed., S + S These operors commue, ssocie, nd disriue +,, c S = + + ( + c) = ( + ) + c ( + c) = + c Boh operors hve unique ideniy elemen + 0 = = S = ( c) = ( ) c Ech elemen hs unique inverse under oh operors + ( ) = 0 = /6/07
Exmple Sclr Fields Rel Numers Complex Numers (given he sndrd definiions for ddiion nd muliplicion) Rionl Funcions (Rios of polynomils) Noion: we will represen sclrs y lower cse leers.,, c, re sclr vriles. /6/07 4
Vecor Spces Vecor spce (V): sclrs nd vecors, denoed y x. Two operions for vecors: vecor-vecor ddiion sclr-vecor muliplicion uv, V u+ v V u V, S u V Vecor-vecor ddiion commues nd ssocies. u + v = v + u u + ( v + w) = ( u + v) + w There is lso n ddiive ideniy, nd n ddiive inverse for ech vecor u + 0 = u u + ( u) = 0 Sclr-vecor muliplicion disriues ( + )u = u + u (u + v) = u + v /6/07 5
Exmple Vecor Spces Geomeric Vecors (direced segmens) u v w u v u + v = w u v N-uples of sclrs u = (,,7) u + v = (,5, 4) = w v = (,, ) u = (,6, 4) w = (,5, 4) v = (,,) No coincidenlly, we cn use N-uples o represen vecors /6/07 6
Bsis Vecors A vecor sis is suse of vecors from V h cn e used o genere ny oher elemen in V, using jus ddiions nd sclr muliplicions. A sis se, v, v,...,, is linerly dependen if: v n n,,..., n 0 such h iv i = 0 i= 0 Oherwise, he sis se is linerly independen. A linerly independen sis se wih i elemens is sid o spn n i-dimensionl vecor spce. Bsis vecors re physicl hings, no numers. /6/07 7
Vecor Coordines A linerly independen sis se cn e used o uniquely nme or ddress vecor. This is he done y ssigning he vecor coordines s follows: c x = cv i i= v v v c = v c i = c Noe: we ll use old leers o indice uples of sclrs h re inerpreed s coordines Our vecors re sill src eniies. So how do we inerpre he equion ove? /6/07 8
Inerpreing Vecor Coordines cv v c cv v c v v v cv cv Vlid Inerpreion cv cv Eqully Vlid Inerpreion Rememer, vecors don hve ny noion of posiion /6/07 9
Liner Trnsforms A liner rnsformion, L, is jus mpping from V o V which sisfies he following properies: L (u + v) = L(u) + L(v) nd L(u) = L(u) Lineriy implies: x L(x) = L c = i v i cil(v i) i i Expressing x wih sis nd coordine vecor gives: c c v v v c L( v) L( v) L( v) c c c Trnsforms my sis vecors nd leves he coordines unchnged /6/07 0
Mrices Liner rnsformions re equivlen o hose h cn e expressed using mrices nd mrix operions. c m m m c L( v) L( v) L( v) c v v v m m m c c m m m c We cn inerpre his expression in one of wo wys m m m c v v v m m m c m m m c chnge of sis vecors m m m c v v v m m m c m m m c chnge of coordines /6/07
Reding Mrix Expressions Ofen we desire o pply sequences of operions o vecors. For insnce, we migh wn o roe priculr vecor, dd i o some oher vecor, nd hen roe he resul ck. In order o specify nd inerpre such sequences, you should ecome proficien reding mrix expressions. Consider he following expression: v c v Mc= v M c= m c ( ) v c v Mc = v ( Mc) = v d Think of his s chnging from one spce o noher (i.e. world spce o eye spce) Think of his s moving n vecor, chnging is coordines, wihin common spce. (i.e. roe norml round some xis) /6/07
The Bsis is Imporn! If you re given coordines nd old o rnsform hem using mrix, you hve no een given enough informion o deermine he finl mpping. Consider he mrix: M = 0 0 If we pply his mrix o coordines here mus e some implied sis, ecuse coordines re no geomeric eniies ( sis is required o conver coordines ino vecor). Assume his implied sis is w. Thus, our coordines descrie he vecor v = w c. The resuling rnsform, w c w Mc, will srech his vecor y fcor of in he direcion of he firs elemen of he sis se. Of course h direcion depends enirely on w. 0 0 0 0 /6/07
Trnsformion Exmple w = [v, v, v ] n = [v, v, v ] These vecors wih idenicl iniil nd finl coordines re very differen geomeric eniies /6/07 4
Poins Concepully, Poins nd Vecors re very differen. A poin is plce in spce. A vecor descries direcion independen of posiion. As menioned previously, we will disinguish eween poins nd vecors in our noion. Poins re denoed s p nd vecors s v. Furhermore, we will consider vecors o live in he Liner spce R nd poins o o live in he Affine spce A. Le s clrify his disincion. /6/07 5
How Vecors nd Poins Differ The operions of ddiion nd muliplicion y sclr re well defined for vecors. The ddiion of vecors expresses he concenion of moions. Muliplying vecor y some fcor scles he moion. However, hese operions don mke sense for poins. Wh should i men o dd wo poins ogeher? For exmple, wh is Rleigh plus Durhm? Wh does i men o muliply poin y n rirry sclr? Wh is 7 imes Chpel Hill? + /6/07 6
Mking Sense of Poins There re some operions h do mke sense for poins. For insnce, if you wn o compue vecor h descries he moion from one poin o noher. p q = v We cn lso find new poin h is some vecor wy from given poin. q + v = p /6/07 7
A Bsis for Poins One of he gols of our definiions is o mke he sule disincions eween poins nd vecors more ppren. The key disincion eween vecors nd poins re h poins re solue wheres vecors re relive. We cn cpure his noion in our definiion of sis se for poins. A vecor spce is compleely defined y se of sis vecors, however, he spce h poins live in requires he specificion of n solue origin. p = o + v ici i = [ v v v o ] Noice how 4 sclrs (one of which is ) re required o idenify -D poin. c c c /6/07 8
Frmes We disinguish eween spces h poins live in nd spces h vecors live in y our sis definiion. We will cll he spces h poins live in Affine spces, nd explin why shorly. We will lso cll ffine-sis-ses frmes. = v v v o [ ] f BTW, frmes cn descrie vecors s well s poins. c c p v v v o = c c c x v v v o = c 0 /6/07 9
Picures of Frmes Grphiclly, we will disinguish eween vecor ses nd ffine ses (frmes) using he following convenion. Three vecors v f Three vecors nd poin /6/07 0
/6/07 A Consisen Model Noe how he ehvior of ffine frme coordines is compleely consisen wih our inuiion. Surcing wo poins yields vecor. Adding vecor o poin produces poin. If you muliply vecor y sclr you sill ge vecor. And, in mos cses, when you scle poins you ll ge some nonsense 4 h coordine elemen, which should serve o remind you h he hing you re lef wih is no longer poin. = 0 + + + = + v v v 0 v v v
Homogeneous Coordines Noice, how we hve snuck up on he ide of Homogeneous Coordines, sed on simple logicl rgumens. Keep he following in mind, coordines re no geomeric, hey re jus scles for sis elemens. Thus, you should no e ohered y he fc h our coordines suddenly hve 4 numers. We could hve hd more (no one sid we hve o hve linerly independen sis se). When you relize h -D homogeneous coordines refer o n ffine frme wih is sis vecors nd origin poin, he 4 coordines suddenly mke sense. Our 4h coordine cn hve one of wo vlues, [0,], indicing if wheher he coordines nme vecor or poin. /6/07
/6/07 Affine Cominions There re cerin siuions where is does mke sense o scle nd dd poins. If you dd scled poins ogeher crefully, you cn end up wih vlid poin. Suppose you hve wo poins, one scled y nd he oher scled y. If we resric he sum of hese lphs, + =, we cn ssure h he resul will hve s i s 4h coordine vlue. + + + = + + + + = + Bu, is i poin?
The Poins Beween This cominion, defines ll poins h shre he line connecing our wo iniil poins. This ide cn e simply exended o, 4, or ny numer of poins. This ype of consrined-scled ddiion is clled ffine cominion (hence, he nme of our spce). In fc, one could define n enire spce in erms of he ffine cominions of elemens y using he i s s coordines, descriing one of our consrined cominion of sis poins. This leds o descripion clled Brycenric Coordines, u h is opic for noher dy. /6/07 4
Affine Trnsformions As wih vecors, we cn pply Liner rnsformions o poins using mrices. However, we will need o use 4 y 4 mrices since our sis se hs four componens. However, we will iniilly limi ourselves o rnsforms h preserve he inegriy of our poins nd vecors. Lierlly, hose rnsforms h produce poin or vecor when given one of he sme. c 4 c c 4 c p v v v o = p v v v o = c 4c 0 0 0 This suse of 4 y 4 mrices hs he propery h i preserves poins nd vecors. This suse of mrices is clled, you guessed i, he ffine suse. /6/07 5
Composing Trnsformions We will ofen wn o specify compliced rnsformions y sringing ogeher sequences of simple mnipulions. For insnce, if you wn o rnsle poins nd hen roe hem ou he origin. Suppose h he rnslion is ccomplished y he mrix operor T, nd he roion is chieved using he mrix, R. Given wh we know now, i is simple mer o consruc his series of operions. p = w c p = w RTc Ech sep in he process cn e considered s chnge of coordines. Alernively, we could hve considered he sme sequence of operions s: Where ech sep is considered s chnge of sis. = w ( R( Tc)) = w ( Rc ) = w p = w c p = w RTc = ((w R) T) c = (m T) c = e c c /6/07 6
Sme Poins These re lerne inerpreions of he sme rnsformions. They men enirely differen hings, however hey resul in he sme se of rnsformed coordines. The firs sequence is considered s rnsformion ou glol frme. The second sequence is considered s chnge in locl frmes. Frequenly, we will mix ogeher hese noions (moving poins nd chnging coordines) in single rnsformion. v o w c w v v ( R( Tc)) c c e v ((w o R ) T) c w v v c /6/07 7
Sme Poin in Differen Frmes Given his frmework, some rher difficul prolems ecome esy o solve. For insnce, suppose you hve frmes, nd you know he coordines of priculr poin relive o one of hem. How would you go ou compuing he coordine of your poin relive o he oher frme? p = w c = z? Suppose h my wo frmes re reled y he rnsform S s shown elow. z = w S nd w = z S Thus, he coordine for he poin in second frme is simply: p = w c = z S c = z ( S c) = z d Susiue for he frme Reorgnize & reinerpre /6/07 8
More Frme Chnges Even hrder prolems ecome simple. Suppose h you wn o roe he poins descriing some ojec (sy cow) ou some rirry xis in spce (sy merry-go-round). This is esy so long s we hve he rnsform reling our wo frmes. Thus, w w Z = m nd w = m Z = m Z m RZ = w ZRZ This is he rnsform h I need o pply o hem since hey re defined in he world sis w m I wn o roe my cow s coordines round he xis of my merry-goround /6/07 9
More Frme Chnges c T c c w v = wm w v? v w ( Tc) = w c = = v ( v ) = v d M c M c ( ) v w = ( w TM ) = ( v T ) M = v M Tc M c ( ) ( w = v ) = v ( M c) = v d /6/07 0
Nex Time -D Trnsformion Mechnics How o find specific rnsform /6/07