![Page 1: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/1.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
2D Geometric Transformations
CS 4620 Lecture 8
1
![Page 2: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/2.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
A little quick math background
• Notation for sets, functions, mappings• Linear transformations• Matrices
– Matrix-vector multiplication– Matrix-matrix multiplication
• Geometry of curves in 2D– Implicit representation– Explicit representation
2
![Page 3: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/3.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Implicit representations
• Equation to tell whether we are on the curve
• Example: line (orthogonal to u, distance k from 0)
• Example: circle (center p, radius r)
• Always define boundary of region – (if f is continuous)
3
(u is a unit vector)
{v | (v � p) · (v � p)� r2 = 0}
![Page 4: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/4.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Explicit representations
• Also called parametric• Equation to map domain into plane
• Example: line (containing p, parallel to u)
• Example: circle (center b, radius r)
• Like tracing out the path of a particle over time• Variable t is the “parameter”
4
![Page 5: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/5.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Transforming geometry
• Move a subset of the plane using a mapping from the plane to itself
• Parametric representation:
• Implicit representation:
5
![Page 6: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/6.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Translation
• Simplest transformation: • Inverse:• Example of transforming circle
6
![Page 7: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/7.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Linear transformations
• One way to define a transformation is by matrix multiplication:
• Such transformations are linear, which is to say:
(and in fact all linear transformations can be written this way)
7
![Page 8: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/8.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Geometry of 2D linear trans.
• 2x2 matrices have simple geometric interpretations– uniform scale– non-uniform scale– rotation– shear– reflection
• Reading off the matrix
8
![Page 9: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/9.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Linear transformation gallery
• Uniform scale
9
![Page 10: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/10.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Linear transformation gallery
• Nonuniform scale
10
![Page 11: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/11.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Linear transformation gallery
• Rotation
11
0.866 �0.50.5 0.866
�
![Page 12: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/12.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Linear transformation gallery
• Reflection– can consider it a special case
of nonuniform scale
12
![Page 13: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/13.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Linear transformation gallery
• Shear
13
![Page 14: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/14.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Composing transformations
• Want to move an object, then move it some more–
• We need to represent S o T (“S compose T”)– and would like to use the same representation as for S and T
• Translation easy–
• Translation by uT then by uS is translation by uT + uS
– commutative!
14
![Page 15: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/15.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Composing transformations
• Linear transformations also straightforward–
• Transforming first by MT then by MS is the same as
transforming by MSMT
– only sometimes commutative• e.g. rotations & uniform scales• e.g. non-uniform scales w/o rotation
– Note MSMT, or S o T, is T first, then S
15
![Page 16: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/16.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Combining linear with translation
• Need to use both in single framework• Can represent arbitrary seq. as
–
–
–
– e. g.
• Transforming by MT and uT, then by MS and uS, is the
same as transforming by MSMT and uS + MSuT
– This will work but is a little awkward16
![Page 17: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/17.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Homogeneous coordinates
• A trick for representing the foregoing more elegantly• Extra component w for vectors, extra row/column for
matrices– for affine, can always keep w = 1
• Represent linear transformations with dummy extra row and column
17
![Page 18: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/18.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Homogeneous coordinates
• Represent translation using the extra column
18
![Page 19: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/19.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Homogeneous coordinates
• Composition just works, by 3x3 matrix multiplication
• This is exactly the same as carrying around M and u – but cleaner– and generalizes in useful ways as we’ll see later
19
![Page 20: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/20.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine transformations
• The set of transformations we have been looking at is known as the “affine” transformations– straight lines preserved; parallel lines preserved– ratios of lengths along lines preserved (midpoints preserved)
20
![Page 21: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/21.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine transformation gallery
• Translation
21
![Page 22: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/22.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine transformation gallery
• Uniform scale
22
![Page 23: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/23.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine transformation gallery
• Nonuniform scale
23
![Page 24: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/24.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine transformation gallery
• Rotation
24
![Page 25: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/25.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine transformation gallery
• Reflection– can consider it a special case
of nonuniform scale
25
![Page 26: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/26.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine transformation gallery
• Shear
26
![Page 27: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/27.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
General affine transformations
• The previous slides showed “canonical” examples of the types of affine transformations
• Generally, transformations contain elements of multiple types– often define them as products of canonical transforms– sometimes work with their properties more directly
27
![Page 28: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/28.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Composite affine transformations
• In general not commutative: order matters!
rotate, then translate translate, then rotate
28
![Page 29: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/29.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Composite affine transformations
• Another example
scale, then rotate rotate, then scale
29
![Page 30: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/30.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Rigid motions
• A transform made up of only translation and rotation is a rigid motion or a rigid body transformation
• The linear part is an orthonormal matrix
• Inverse of orthonormal matrix is transpose– so inverse of rigid motion is easy:
30
![Page 31: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/31.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Composing to change axes
• Want to rotate about a particular point– could work out formulas directly…
• Know how to rotate about the origin– so translate that point to the origin
31
![Page 32: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/32.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Composing to change axes
• Want to scale along a particular axis and point• Know how to scale along the y axis at the origin
– so translate to the origin and rotate to align axes
32
![Page 33: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/33.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Transforming points and vectors
• Recall distinction points vs. vectors– vectors are just offsets (differences between points)– points have a location
• represented by vector offset from a fixed origin
• Points and vectors transform differently– points respond to translation; vectors do not
33
![Page 34: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/34.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Transforming points and vectors
• Homogeneous coords. let us exclude translation– just put 0 rather than 1 in the last place
– and note that subtracting two points cancels the extra coordinate, resulting in a vector!
• Preview: projective transformations– what’s really going on with this last coordinate?
– think of R2 embedded in R3: all affine xfs. preserve z=1 plane
– could have other transforms; project back to z=1
34
![Page 35: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/35.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
More math background
• Coordinate systems– Expressing vectors with respect to bases– Linear transformations as changes of basis
35
![Page 36: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/36.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine change of coordinates
• Six degrees of freedom
or
36
![Page 37: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/37.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine change of coordinates
• Coordinate frame: point plus basis• Interpretation: transformation
changes representation ofpoint from one basis to another
• “Frame to canonical” matrix hasframe in columns– takes points represented in frame– represents them in canonical basis– e.g. [0 0], [1 0], [0 1]
• Seems backward but bears thinking about
37
![Page 38: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/38.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine change of coordinates
• A new way to “read off” the matrix– e.g. shear from earlier– can look at picture, see effect
on basis vectors, writedown matrix
• Also an easy way to construct transforms– e. g. scale by 2 across direction (1,2)
38
![Page 39: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/39.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Affine change of coordinates
• When we move an object to the origin to apply a transformation, we are really changing coordinates– the transformation is easy to express in object’s frame– so define it there and transform it
– Te is the transformation expressed wrt. {e1, e2}
– TF is the transformation expressed in natural frame
– F is the frame-to-canonical matrix [u v p]
• This is a similarity transformation
39
![Page 40: 2D Geometric Transformations - Cornell · PDF file2D Geometric Transformations ... Homogeneous coordinates ... – the transformation is easy to express in object’s frame](https://reader034.vdocuments.us/reader034/viewer/2022052309/5aa1afba7f8b9a46238c13d4/html5/thumbnails/40.jpg)
© 2014 Steve Marschner • Cornell CS4620 Fall 2014 • Lecture 8
Coordinate frame summary
• Frame = point plus basis• Frame matrix (frame-to-canonical) is
• Move points to and from frame by multiplying with F
• Move transformations using similarity transforms
40