D Transformations
Graphics Eample: Tpe Setting
Modern Computerized Tpesetting Each letter is defined in its own coordinate sstem And positioned on the page coordinate sstem It is ver simple, m she thought, ou get up, ou go, ou do, ou see, ou put one foot in front of the other & along the wa ou do our ver best to enjo it.
Local vs. Global Coordinate Sstems m u Converting from local to global? v m. Map [,] to [, ]. Add 3. Map [,] to [, ] 4. Add u v ( ( ( ( ) ) ) ) u,v [,]
Map & Translate v m u Converting from local to global? Assume local is defined on [,] a p m. Map [,][,] to a a a a. Translate to p = (, ) a ua va
Two Stages: Map & Translate Two basic operations: Mapping the vector (u,v) to a new vector Translating the origin to p u v a a p va ua p v u a a a a v u a a (,)
Matri Form a a The matri A = is called a a a Linear Map and it maps a vector (u,v) to a vector (u,v ) a p a u' v' a a a a u v v (,) u Note: we forget the translation for now!
Linear Maps & Matrices We have 4 numbers in the matri An combination gives a general linear transformation (map) From Algebra we know that the preserve linear combinations: A( c c Av c Av v cv)
Working with Matrices CA BA A C B AC AB C B A C AB BC A C B A C B A BA AB A B B A ) ( ) ( ) ( ) ( ) ( ) ( ) (Note:in general Commutative Law: Associative Laws: Distributive Laws:
Special Linear Maps Special combinations of the matri entries give specific tpes of linear maps: Scale (uniform & non-uniform) Reflection Rotation Shear Projection
Scale Map: = s = s Eample: Matri form: If s s it is a non-uniform scale 3 3 (,) s s S
Mapping Objects Eample: Uniform vs. Non-uniform Scale (,) 3 4 3 Non-uniform (,) (,) Uniform (,)
Reflections (,) About (,) (,) About (,) (,) About = (,)
Rotation Given an angle the map for rotation in counterclockwise direction is: = cos()- sin() = sin()+ cos() Matri form: (,) R cos( ) sin( ) sin( ) cos( )
Rotation
Shear Map: = + h = + h Eample: Matri form: h h H (,) (,) deforms as function of
Projections Onto : (,) (,) Onto : In general if v =(, ) and v are parallel (v =cv =(c, c ) then following map is a projection onto the line of their direction (,) c c
Reducing Dimension Man vectors are all mapped to the same vector b projection In fact an line in D is projected onto a point on the projection line This is wh projections reduce the dimension Once projected, the points on the line cannot be distinguished from each other This also means there is no inverse mapping to projection (,) How about the other maps?
Inverse Maps The matri of the inverse transformation is the inverse matri of the transformation: ) cos( ) sin( ) sin( ) cos( ) cos( ) sin( ) sin( ) cos(
Combining Transformations I Matri multiplication is associative, hence instead of appling each map alone we can multipl the matrices to create the final map: cba cba cb cb c c A B A C B A M ABC C B A C B A
Eample: Rotate & Shear BA AB (,) (,) (,) B A (,) (,)
Order is Important! First shear then rotate (AB) is different than first rotate then shear (BA)! Reason: matri multiplication is NOT commutative Eception? rotations are commutative: Rotate b and then b β is the same as rotating b β and then b.
The Origin In ALL linear transformation the origin (,) remains stationar: Image(origin) = origin Problem? What operation cannot be represented?
Translation Map: = + t = + t Can be defined as p = p+v Note: since vectors do not have position, translation is an operation on points! (,) t v p t p
Affine Maps Includes both a linear map A and a translation v p = Ap+v Linear maps can be seen as a subset of affine maps (translation v = )
Eample : Rotating Around a Point We defined rotation around (,). How can we rotate in degrees around an arbitrar point q? (,) q Translate Rotate Translate back (,) (,) (,)
Eample : Rotating Around a Point. Translate q to the origin (v=q-). Rotate around the origin in degrees 3. Translate back This is an affine map: q (,) p = R (p-v)+v
Propert: Does Not Preserve Distance! A transformation that preserves distances is called an isometr. For eample: rotation, translation, reflection. However, most linear maps do not, and therefore also most affine maps don t For eample scaling: (,) (,)
Propert: Preserves Line and Ratios Assume Let A+v be an affine map that maps p, p, p 3 to p, p, p 3 Now we have: p 3 p p Affine transformations preserve ratios! p p p 3
Matri Notation? The matri notation for the general Affine transformation cannot represent translation using matrices Solution: use homogeneous coordinates
Homogeneous Coordinates August Ferdinand Möbius Homogeneous coordinates are a mapping from R n to R n+ as follows: (,) (X,Y,W) where X=W, Y=W Note: for all t the points (t,t,t) correspond to the same point (,): (,3,)(6,9,3) (4,6,). Usuall it is customar to use w= (normalize it if not)
Geometric Interpretation W D point is mapped to a line (ra) in 3D passing through the origin. (non-homogeneous) points are obtained b projecting the ras onto the plane Z=. Y (X,Y,) (X,Y,W) X
Translation in Homogeneous Coordinates Using homogeneous coordinates we can represent a translation using the following matri: (,) is mapped b this matri to (+t,+t) t t t t
General Affine Maps Linear maps can still use the top left minor of the matri Hence, combining both linear maps and translation we get the general affine map matri form: f d c e b a
Combining Transformations II Multipling two affine maps creates an affine map: Hence, we can combine transformations in a similar manner as linear maps Remember: order is still important: AB BA f f d e c d d c b c d a c e f b a e b d a b b c a a f d c e b a f d c e b a
Eample Revisited Rotating around an arbitrar point (, ) sin ) cos ( cos sin sin ) cos ( sin cos cos sin sin cos Translate Rotate Translate back
Eample : Reflection About a Line. Find p on the line. Move p to the origin 3. Rotate so that the line lies on the ais 4. Reflect about the ais 5. Rotate back 6. Move back p v (,)
Geometric Stages Translate Rotate v v v p p p - (,) (,) (,) 5 Translate back 4 Rotate back 3 Reflect v v v p p p (,) (,) (,)
In Matri Form ) cos( ) sin( ) sin( ) cos( cos sin sin cos p p p p M Translate Rotate Rotate back Reflect Translate back
Defining Affine Transformations Given k points (p,p,..p k ) in D that have been transformed to (p',p',..,p' k ) b an affine transformation. How man points are needed to uniquel define the transformation? 6 unknowns a c b d e f
Three Points One pair of points can define the translation (translate p to p' ) to get e and f Now we need to define a linear transformation Using another two pairs of points we can define two pairs of vectors: v =p - p, v 3 =p 3 - p, v' =p' - p', v 3 =p' 3 - p' that uniquel define the transformation: d c b a v v v v v v v v d c b a 3 3 3 3 ' ' ' ' p p p 3 p p p 3
Mapping Two Triangles Hence, given the mapping between two triangles, or three pairs of points, defines an affine map: p p p 3 p p p 3 p p 3 p p 3 p p
Back to Coordinate Sstems In a similar manner: converting from global to local coordinate sstem is done using an affine map Conversion between an coordinate sstem is defined b an affine map (,)
Affine Transformations Properties Closed under composition Origin does not map to origin Does not preserve distances Lines map to lines Ratios are preserved Parallel lines remain parallel
Projective Transformations What if we use a full 33 matri to transform homogeneous points? We obtain a richer variet of possible maps which are called Projective warps w i h g f e d c b a w ' ' '
Transformation Eamples Original Linear: Scale & Rotate Affine Projective
Projective Transformations Properties Closed under composition Origin does not map to origin Does not preserve distances Lines map to lines Ratios are not preserved (but cross-ratios are) Parallel lines do not remain parallel
More Eamples Original Linear: Scale & Rotate Affine Projective
Special Tpes of Transformations Rigid transformation: Translation + Rotation (distance preserving). How man D.O.F? Similarit transformation: Translation + Rotation + uniform Scale (angle preserving). How man D.O.F? Affine transformation: Translation + Rotation + Scale + Shear (parallelism preserving). How man D.O.F? All above transformations are groups where Rigid Similarit Affine.
Summar of Transformations Projective Affine Similarit Rigid