Example: stock market

Affine Transformations - Clemson University

A P P E N D I XCAffine The need for geometric Affine Matrix representation of the linear Homogeneous 3D form of the Affine THE NEED FOR GEOMETRIC TRANSFORMATIONSOne could imagine a computer graphics system that requires the user to construct ev-erything directly into a single scene. But, one can also immediately see that this wouldbe an extremely limiting approach. In the real world, things come from various placesand are arranged together to create a scene. Further, many of these things are themselvescollections of smaller parts that are assembled together. We may wish to define one objectrelative to another for example we may want to place a hand at the end of an arm. Also,it is often the case that parts of an object are similar, like the tires on a car.

C.2 AFFINE TRANSFORMATIONS Let us first examine the affine transforms in 2D space, where it is easy to illustrate them with diagrams, then later we will look at the affines in 3D. Consider a point x = (x;y). Affine transformations of x are all transforms that can be written x0= " ax+ by+ c dx+ ey+ f #; where a through f are scalars. x c f x´

Tags:

  Transformation, Affine, Affine transformations

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Affine Transformations - Clemson University

1 A P P E N D I XCAffine The need for geometric Affine Matrix representation of the linear Homogeneous 3D form of the Affine THE NEED FOR GEOMETRIC TRANSFORMATIONSOne could imagine a computer graphics system that requires the user to construct ev-erything directly into a single scene. But, one can also immediately see that this wouldbe an extremely limiting approach. In the real world, things come from various placesand are arranged together to create a scene. Further, many of these things are themselvescollections of smaller parts that are assembled together. We may wish to define one objectrelative to another for example we may want to place a hand at the end of an arm. Also,it is often the case that parts of an object are similar, like the tires on a car.

2 And, eventhings that are built on scene, like a house for example, are designed elsewhere, at a scalethat is usually many times smaller than the house as it is built. Even more to the point,we will often want to animate the objects in a scene, requiring the ability to move themaround relative to each other. For animation we will want to be able to move not onlythe objects, but also the camera, as we render a sequence of images as time advancesto create an illusion of motion. We need good mechanisms within a computer graphicssystem to provide the flexibility implied by all of the issues raised Foundations of Physically Based Modeling and AnimationThe figure below shows an example of what we mean. On the left, a cylinder has been builtin a convenient place, and to a convenient size.

3 Because of the requirements of a scene,it is first scaled to be longer and thinner than its original design, rotated to a desiredorientation in space, and then moved to a desired position ( translated). The set ofoperations providing for all such Transformations , are known as theaffine transforms. Theaffines include translations and all linear Transformations , like scale, rotate, and cylindermodelTransformed cylinder. It hasbeen scaled, rotated, and Affine TRANSFORMATIONSLet us first examine the Affine transforms in 2D space, where it is easy to illustrate themwith diagrams, then later we will look at the affines in a pointx=(x,y). Affine Transformations ofxare all transforms that can bewrittenx =[ax+by+cdx+ey+f],whereathroughfare For example, ifa,e=1, andb,d=0, then we have a puretranslationx =[x+cy+f].

4 Xoaxxyeyx Ifb,d=0andc,f=0then we have a pure =[axey] Affine Transformations 337x o x And, ifa,e=cos ,b= sin ,d=sin , andc,f=0, then wehave a pure rotation about the originx =[xcos ysin xsin +ycos ].xobydxxyx Finally ifa,e=1, andc,f=0we have the shear transformsx =[x+byy+dx].In summary, we have the four basic Affine Transformations shown in the figure below: Translate moves a set of points a fixed distance inxandy, Scale scales a set of points up or down in thexandydirections, Rotate rotates a set of points about the origin, Shear offsets a set of points a distance proportional to that only shear and scale change the shape determined by a set of Foundations of Physically Based Modeling and MATRIX REPRESENTATION OF THE LINEAR TRANS-FORMATIONSThe Affine transforms scale, rotate and shear are actually linear transforms and can berepresented by a matrix multiplication of a point represented as a vector,[x y ]=[ax+bydx+ey]=[abde] [xy],orx =Mx, whereMis the very nice feature of the matrix representation is that we can use it to factor a complextransform into a set of simpler transforms.

5 For example, suppose we want to scale anobject up to a new size, shear the object to a new shape, and finally rotate the object. LetSbe the scale matrix,Hbe the shear matrix andRbe the rotation matrix. Thenx =R(H(Sx))defines a sequence of three transforms: 1st-scale, 2nd-shear, 3rd-rotate. Because ma-trix multiplication is associative, we can remove the parentheses and multiply the threematrices together, giving a new matrixM=RHS. Now we can rewrite our transformx =(RHS)x=MxIf we have to transform thousands of points on a complex model, it is clearly easier todo one matrix multiplication, rather than three, each time we want to transform a , matrices are a very powerful way to encapsulate a complex transform and to storeit in a compact and convenient matrix form, we can catalog the linear transforms asScale:[sx00sy],Rotate:[cos sin sin cos ],Shear.

6 [1hxhy1],wheresxandsyscale thexandycoordinates of a point, is an angle of counterclockwiserotation around the origin,hxis a horizontal shear factor, andhyis a vertical shear HOMOGENEOUS COORDINATESS ince the matrix form is so handy for building up complex transforms from simpler ones,it would be very useful to be able to represent all of the Affine transforms by problem is that translation is not a linear transform. The way out of this dilemma isto turn the 2D problem into a 3D problem, but inhomogeneous first take all of our pointsx=(x,y), express them as 2D vectors[xy]and make theseAffine Transformations 339into 3D vectors with identical (thus the term homogeneous) 3rd coordinates set to 1:[xy]= xy1 .By convention, we call this third coordinate thewcoordinate, to distinguish it from theusual 3 Dzcoordinate.

7 We also extend our 2D matrices to 3D homogeneous form byappending an extra row and column, givingScale: sx000sy0001 ,Rotate: cos sin 0sin cos 0001 ,Shear: 1hx0hy10001 .Note what happens when we multiply our 3D homogeneous matrices by 3D homoge-neous vectors: ab0de0001 xy1 = ax+bydx+ey1 .x y w plane w=1 p1 p0 p3 p2 This is the same result as in 2D, with the excep-tion of the extrawcoordinate, which remains we have really done is to place all of our 2 Dpoints on the planew=1in 3D space, and nowwe do all the operations on this plane. Really, theoperations are still 2D , the magic happens when we place the translation parameterscandfin the matrixin the 3rd column: abcdef001 xy1 = ax+by+cdx+ey+f1 We can now do translations as linear operations in homogeneous coordinates! So, we canadd a final matrix to our catalog:Translate: 104x014y001 ,where4xis the translation in thexdirection and4yis the translation in theydirection.

8 Theastute reader will see the trick behind the magic 2D translation is now being expressedas a shear in 3D Foundations of Physically Based Modeling and Animationxyxyxy(-1,-1)(-1,1)(1,-1)(3,2)( 0,- 2 )(1,1)(3+ 2, 2 )(3- 2, 2 )(3,2+ 2 )(3,2- 2 )(0, 2 )( 2 ,0)(- 2 ,0)12rotate 45otranslate (3, 2)Now, suppose we have a2 2squarecentered at the origin and we want tofirst rotate the square by45 about itscenter and then move the square so itscenter is at(3,2). We can do this in twosteps, as shown in the diagram to matrix form:M=T(3,2)R45 = 103012001 cos 45 sin 45 0sin 45 cos 45 0001 = cos 45 sin 45 3sin 45 cos 45 2001 = 2/2 2/23 2/2 2/22001 .Note thatM 111 = 32+ 21 ,andM 111 = 3 221 ,verifying that we get the same resultshown in the 3D FORM OF THE Affine TRANSFORMATIONSNow, we can extend all of these ideas to 3D in the following way:1.

9 Convert all 3D points to homogeneous coordinates xyz = xyz1 .The extra (4th) coordinate is again called Transformations 3412. Use matrices to represent the 3D Affine transforms in homogeneous following matrices constitute the basic Affine transforms in 3D, expressed in homo-geneous form:Translate: 1004x0104y0014z0001 ,Scale: sx0000sy0000sz00001 ,andShear: 1hxyhxz0hyx1hyz0hzxhzy100001 .In addition, there are three basic rotations in 3D,Rotation about thexaxis: 10000cos x sin x00sin xcos x00001 ,Rotation about theyaxis: cos y0sin y00100 sin y0cos y00001 ,andRotation about thezaxis: cos z sin z00sin zcos z0000100001 .The rotations, specified in this way, determine an amount of rotation about each of theindividual axes of the coordinate system. The angles x, y, and zof rotation about thethree axes are called the Euler angles.

10 They can be used to describe an off-axis rotation, bycombining Euler angle rotations via matrix multiplication. Note, however, that the order ofrotation affects the end result, so besides specifying Euler angles, an order of rotation mustbe specified. In general, Affine Transformations are associative but are not commutative,so the order in which operations are done is highly important. One can see this forrotations by computing the productR xR yR z, and comparing with the result obtainedby the productR zR yR x. Please see Appendix D for a more powerful and general lookat rotation.


Related search queries