Presentation is loading. Please wait.

Presentation is loading. Please wait.

©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20151 CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture.

Similar presentations


Presentation on theme: "©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20151 CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture."— Presentation transcript:

1 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20151 CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture 11 – September 29, 2011

2 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20152 Today’s Topics Linear Algebra Review  Matrices  Transformations New Linear Algebra  Homogeneous Coordinates

3 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20153 Matrices We use 2x2, 3x3, and 4x4 matrices in computer graphics. We’ll start with a review of 2D matrices and transformations.

4 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20154 Basic 2D Linear Transforms

5 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20155 Scale by.5 (1, 0) (0.5, 0) (0, 1) (0, 0.5)

6 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20156 Scaling by.5 y x y x

7 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20157 General Scaling y x y x

8 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20158 General Scaling sxsx 1 1 sysy y x y x

9 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20159 Rotation φ φ sin(φ) cos(φ) -sin(φ) cos(φ)

10 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201510 Rotation y x y x φ

11 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201511 Reflection in y-axis

12 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201512 Reflection in y-axis y x y x

13 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201513 Reflection in x-axis

14 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201514 Reflection in x-axis y x y x

15 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201515 Shear-x s

16 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201516 Shear x y x y x

17 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201517 Shear-y s

18 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201518 Shear y y x y x

19 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201519 Linear Transformations Scale, Reflection, Rotation, and Shear are all linear transformations They satisfy: T( a u + b v) = a T(u) + b T(v)  u and v are vectors  a and b are scalars If T is a linear transformation  T((0, 0)) = (0, 0)

20 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201520 Composing Linear Transformations If T 1 and T 2 are transformations  T 2 T 1 (v) = def T 2 ( T 1 (v)) If T 1 and T 2 are linear and are represented by matrices M 1 and M 2  T 2 T 1 is represented by M 2 M 1  T 2 T 1 (v) = T 2 ( T 1 (v)) = (M 2 M 1 )(v)

21 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201521 Reflection About an Arbitrary Line ( through the origin ) y x y x

22 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201522 Reflection as a Composition y x

23 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201523 Decomposing Linear Transformations Any 2D Linear Transformation can be decomposed into the product of a rotation, a scale, and a rotation if the scale can have negative numbers. M = R 1 SR 2

24 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201524 Rotation about an Arbitrary Point y x φ y x φ This is not a linear transformation. The origin moves.

25 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201525 Translation y x y x (a, b) This is not a linear transformation. The origin moves. (x, y)  (x+a,y+b)

26 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201526 Homogeneous Coordinates x x y z y Embed the xy-plane in R 3 at z = 1. (x, y)  (x, y, 1)

27 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201527 2D Linear Transformations as 3D Matrices Any 2D linear transformation can be represented by a 2x2 matrix or a 3x3 matrix

28 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201528 2D Linear Translations as 3D Matrices Any 2D translation can be represented by a 3x3 matrix. This is a 3D shear that acts as a translation on the plane z = 1.

29 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201529 Translation as a Shear x x y z y

30 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201530 2D Affine Transformations An affine transformation is any transformation that preserves co-linearity (i.e., all points lying on a line initially still lie on a line after transformation) and ratios of distances (e.g., the midpoint of a line segment remains the midpoint after transformation). With homogeneous coordinates, we can represent all 2D affine transformations as 3D linear transformations. We can then use matrix multiplication to transform objects.

31 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201531 y x Rotation about an Arbitrary Point y x φ φ

32 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201532 y x Rotation about an Arbitrary Point φ T(-c x, -c y ) R(φ) T(c x, c y ) φ φφ

33 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201533 Windowing Transforms (a,b) (A,B) (c,d) (C,D) (C-c,D-d) (A-a,B-b) translate scale translate

34 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201534 3D Transformations Remember: A 3D linear transformation can be represented by a 3x3 matrix.

35 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201535 3D Affine Transformations

36 ©College of Computer and Information Science, Northeastern UniversitySeptember 9, 201536 3D Rotations


Download ppt "©College of Computer and Information Science, Northeastern UniversitySeptember 9, 20151 CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture."

Similar presentations


Ads by Google