Presentation is loading. Please wait.

Presentation is loading. Please wait.

2D Geometric Transformations

Similar presentations


Presentation on theme: "2D Geometric Transformations"— Presentation transcript:

1 2D Geometric Transformations

2 How do we use Geometric Transformations?
Objects in a scene at the lowest level are a collection of vertices

3 How do we use Geometric Transformations?
A scene has a camera/view point from which the scene is viewed The camera has some location and some orientation in 3D-space These correspond to Translation and Rotation transformations

4 Linear Transformations
The vectors in the set are linearly independent Any vector in the vector space can be expressed as a linear combination of the basis vectors: V = c1V1 + c2V2 Vector addition: f(e1+e2) = f(e1) + f(e2) Scalar multiplication: f(c e1) = cf(v e1) for all scalars c f(x) = f(x1 , x2) := (3x1+2x2 , -3x1+4x2) f(e1 +e2) = f(e1(1)+ e2(1) , e1(2)+ e2(2)) = (3(e1(1)+ e2(1) )+2(e1(2)+ e2(2) ) , - 3(e1(2) + e2(2) )+4(e1(2)+ e2(2) )) = (3 e1(1) +2 e1(2) , -3 e1(1) +4 e1(2)) + (3 e2(1) +2 e2(2) , -3 e2(2) +4 e2(2) = f(e1) + f(e2)

5 Linear Transformations
f(x) = f(x1 , x2) := (3x1+2x2 , -3x1+4x2) f(x) = Tx, where T = −3 4 and x = T is a matrix representing a linear transformation. If T is invertible, then there is a sequence of rotations, scales, and/or shears It can perform the mapping represented by that linear transformation

6 2D Transformations Linear transformations can be represented as invertible (non-singular) matrices 2D transformations can be represented by 2x2 matrices: A transformation of an arbitrary column vector x = has the form:

7 Transformations of Points around the Origin
Rotations Scaling Graphical usage leaves the origin invariant

8 Transformations of Points around the Origin
e1 and e2 be the standard basis vectors: This a strategy for deriving transformation matrices

9 Scale Transformation Matrix
Scale x by 3, y by 2 (Sx = 3, Sy = 2) v = (original vertex); v’ = (new vertex) v’ = Sv Derive S by determining how e1 and e2 should be transformed (scale in X by Sx) (scale in Y by Sy)

10 Rotation Transformation Matrix
Rotate by θ about the origin v’ = Rθv, where v = (original vertex) v’ = (new vertex) e1 and e2 should be transformed to derive R (first column of Rθ) (second column of Rθ ) R v =

11 Rotation Properties Rotation preserves lengths in objects and angles between parts of objects (rigid-body rotation) For objects not centered at the origin, an unwanted translation might be introduced (rotation is always about the origin)

12 Translation Transformation Matrix
Translation is not a linear transformation. The origin is not invariant Translation can’t be represented as a 2x2 invertible matrix The solution? v’ = v + t, where t = Using vector addition is not consistent with 2x2 transformations as matrices Homogeneous Coordinates adds an additional dimension, the w-axis, and an extra coordinate, the w-component 2D -> 3D ( 3D is hyperspace for embedding 2D space

13 Homogeneous Coordinates
Allow expression of all three 2D transformations as 3x3 matrices We start with the point P2d on the xy plane and apply a mapping to bring it to the w-plane in the hyperspace P2d(x,y)  Ph(wx, wy, w), w≠0 The resulting (x’,y’) coordinates in our new point Ph are different from the original (x,y), x’ = wx, y’ = wy Ph(x’, y’, w), w ≠ 0 To obtain the corresponding point in 2D-space, it is required perform the inverse of the previous mapping (divide all entries by w) The vertex v = is now represented as v=

14 Homogeneous Coordinates
We want our transformations T to map points v = to points v’ = Coordinates have been translated, and v’ is still homogeneous

15 Homogenized Transformations
Scale by 15 in the x direction, 17 in the y Rotation: Rotate by 123o Rotate by 123o Translate by -16 in the x direction, +18 in the y

16

17 Shearing Transformation Matrix
Y X 1 2 3 4 5 6 7 8 9 10 Squares become parallelograms; x-coordinates skew to right, y stays the same The base of the house (at y = 1) remains horizontal but shifts right. 2D homogeneous 2D non-homogeneous

18 Reflection Transformation Matrix

19


Download ppt "2D Geometric Transformations"

Similar presentations


Ads by Google