logging in or signing up matrix_2D ankush85 Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 247 Category: Education License: All Rights Reserved Like it (2) Dislike it (0) Added: March 06, 2009 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript 2D Transformations with Matrices : 2D Transformations with Matrices Slide 2: Matrices A matrix is a rectangular array of numbers. A general matrix will be represented by an upper-case italicised letter. The element on the ith row and jth column is denoted by ai,j. Note that we start indexing at 1, whereas C indexes arrays from 0. Slide 3: Given two matrices A and B if we want to add B to A (that is form A+B) then if A is (n?m), B must be (n?m), Otherwise, A+B is not defined. The addition produces a result, C = A+B, with elements: Matrices – Addition Slide 4: Given two matrices A and B if we want to multiply B by A (that is form AB) then if A is (n?m), B must be (m?p), i.e., the number of columns in A must be equal to the number of rows in B. Otherwise, AB is not defined. The multiplication produces a result, C = AB, with elements: (Basically we multiply the first row of A with the first column of B and put this in the c1,1 element of C. And so on…). Matrices – Multiplication Slide 5: Matrices – Multiplication (Examples) 2?6+ 6?3+ 7?2=44 Undefined! 2x2 x 3x2 2!=3 2x2 x 2x4 x 4x4 is allowed. Result is 2x4 matrix Slide 6: Unlike scalar multiplication, AB ? BA Matrix multiplication distributes over addition: A(B+C) = AB + AC Identity matrix for multiplication is defined as I. The transpose of a matrix, A, is either denoted AT or A’ is obtained by swapping the rows and columns of A: Matrices -- Basics Slide 7: 2D Geometrical Transformations Slide 8: Translate Points Recall.. We can translate points in the (x, y) plane to new positions by adding translation amounts to the coordinates of the points. For each point P(x, y) to be moved by dx units parallel to the x axis and by dy units parallel to the y axis, to the new point P’(x’, y’ ). The translation has the following form: In matrix format: If we define the translation matrix , then we have P’ =P + T. Slide 9: Scale Points Points can be scaled (stretched) by sx along the x axis and by sy along the y axis into the new points by the multiplications: We can specify how much bigger or smaller by means of a “scale factor” To double the size of an object we use a scale factor of 2, to half the size of an obejct we use a scale factor of 0.5 If we define , then we have P’ =SP Slide 10: Rotate Points (cont.) Points can be rotated through an angle ? about the origin: P’ =RP Review… : Review… Translate: P’ = P+T Scale: P’ = SP Rotate: P’ = RP Spot the odd one out… Multiplying versus adding matrix… Ideally, all transformations would be the same.. easier to code Solution: Homogeneous Coordinates Slide 12: Homogeneous Coordinates For a given 2D coordinates (x, y), we introduce a third dimension: [x, y, 1] In general, a homogeneous coordinates for a 2D point has the form: [x, y, W] Two homogeneous coordinates [x, y, W] and [x’, y’, W’] are said to be of the same (or equivalent) if x = kx’ eg: [2, 3, 6] = [4, 6, 12] y = ky’ for some k ? 0 where k=2 W = kW’ Therefore any [x, y, W] can be normalised by dividing each element by W: [x/W, y/W, 1] Slide 13: Homogeneous Transformations Now, redefine the translation by using homogeneous coordinates: Similarly, we have: Scaling Rotation P’ = S ? P P’ = R ? P Slide 14: Composition of 2D Transformations Additivity of successive translations We want to translate a point P to P’ by T(dx1, dy1) and then to P’’ by another T(dx2, dy2) On the other hand, we can define T21= T(dx1, dy1) T(dx2, dy2) first, then apply T21 to P: where Slide 15: Examples of Composite 2D Transformations Slide 16: Composition of 2D Transformations (cont.) Multiplicativity of successive scalings where Slide 17: Composition of 2D Transformations (cont.) 3. Additivity of successive rotations where Slide 18: Composition of 2D Transformations (cont.) 4. Different types of elementary transformations discussed above can be concatenated as well. where Slide 19: Consider the following two questions: translate a line segment P1 P2, say, by -1 units in the x direction and -2 units in the y direction. 2). Rotate a line segment P1 P2, say by ? degrees counter clockwise, about P1. P1(1,2) P2(3,3) P’2 P’1 P1(1,2) P2(3,3) P’2 P’1 ? Slide 20: Other Than Point Transformations… Translate Lines: translate both endpoints, then join them. Scale or Rotate Lines: More complex. For example, consider to rotate an arbitrary line about a point P1, three steps are needed: 1). Translate such that P1 is at the origin; 2). Rotate; 3). Translate such that the point at the origin returns to P1. ? Slide 21: Another Example. Scale Translate Rotate Translate Slide 22: Order Matters! As we said, the order for composition of 2D geometrical transformations matters, because, in general, matrix multiplication is not commutative. However, it is easy to show that, in the following four cases, commutativity holds: 1). Translation + Translation 2). Scaling + Scaling 3). Rotation + Rotation 4). Scaling (with sx = sy) + Rotation just to verify case 4: if sx = sy, M1 = M2. Slide 23: Rigid-Body vs. Affine Transformations A transformation matrix of the form where the upper 2?2 sub-matrix is orthogonal, preserves angles and lengths. Such transforms are called rigid-body transformations, because the body or object being transformed is not distorted in any way. An arbitrary sequence of rotation and translation matrices creates a matrix of this form. The product of an arbitrary sequence of rotation, translations, and scale matrices will cause an affine transformation, which have the property of preserving parallelism of lines, but not of lengths and angles. Slide 24: Rigid-Body vs. Affine Transformations (cont.) Shear transformation is also affine. You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
matrix_2D ankush85 Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 247 Category: Education License: All Rights Reserved Like it (2) Dislike it (0) Added: March 06, 2009 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript 2D Transformations with Matrices : 2D Transformations with Matrices Slide 2: Matrices A matrix is a rectangular array of numbers. A general matrix will be represented by an upper-case italicised letter. The element on the ith row and jth column is denoted by ai,j. Note that we start indexing at 1, whereas C indexes arrays from 0. Slide 3: Given two matrices A and B if we want to add B to A (that is form A+B) then if A is (n?m), B must be (n?m), Otherwise, A+B is not defined. The addition produces a result, C = A+B, with elements: Matrices – Addition Slide 4: Given two matrices A and B if we want to multiply B by A (that is form AB) then if A is (n?m), B must be (m?p), i.e., the number of columns in A must be equal to the number of rows in B. Otherwise, AB is not defined. The multiplication produces a result, C = AB, with elements: (Basically we multiply the first row of A with the first column of B and put this in the c1,1 element of C. And so on…). Matrices – Multiplication Slide 5: Matrices – Multiplication (Examples) 2?6+ 6?3+ 7?2=44 Undefined! 2x2 x 3x2 2!=3 2x2 x 2x4 x 4x4 is allowed. Result is 2x4 matrix Slide 6: Unlike scalar multiplication, AB ? BA Matrix multiplication distributes over addition: A(B+C) = AB + AC Identity matrix for multiplication is defined as I. The transpose of a matrix, A, is either denoted AT or A’ is obtained by swapping the rows and columns of A: Matrices -- Basics Slide 7: 2D Geometrical Transformations Slide 8: Translate Points Recall.. We can translate points in the (x, y) plane to new positions by adding translation amounts to the coordinates of the points. For each point P(x, y) to be moved by dx units parallel to the x axis and by dy units parallel to the y axis, to the new point P’(x’, y’ ). The translation has the following form: In matrix format: If we define the translation matrix , then we have P’ =P + T. Slide 9: Scale Points Points can be scaled (stretched) by sx along the x axis and by sy along the y axis into the new points by the multiplications: We can specify how much bigger or smaller by means of a “scale factor” To double the size of an object we use a scale factor of 2, to half the size of an obejct we use a scale factor of 0.5 If we define , then we have P’ =SP Slide 10: Rotate Points (cont.) Points can be rotated through an angle ? about the origin: P’ =RP Review… : Review… Translate: P’ = P+T Scale: P’ = SP Rotate: P’ = RP Spot the odd one out… Multiplying versus adding matrix… Ideally, all transformations would be the same.. easier to code Solution: Homogeneous Coordinates Slide 12: Homogeneous Coordinates For a given 2D coordinates (x, y), we introduce a third dimension: [x, y, 1] In general, a homogeneous coordinates for a 2D point has the form: [x, y, W] Two homogeneous coordinates [x, y, W] and [x’, y’, W’] are said to be of the same (or equivalent) if x = kx’ eg: [2, 3, 6] = [4, 6, 12] y = ky’ for some k ? 0 where k=2 W = kW’ Therefore any [x, y, W] can be normalised by dividing each element by W: [x/W, y/W, 1] Slide 13: Homogeneous Transformations Now, redefine the translation by using homogeneous coordinates: Similarly, we have: Scaling Rotation P’ = S ? P P’ = R ? P Slide 14: Composition of 2D Transformations Additivity of successive translations We want to translate a point P to P’ by T(dx1, dy1) and then to P’’ by another T(dx2, dy2) On the other hand, we can define T21= T(dx1, dy1) T(dx2, dy2) first, then apply T21 to P: where Slide 15: Examples of Composite 2D Transformations Slide 16: Composition of 2D Transformations (cont.) Multiplicativity of successive scalings where Slide 17: Composition of 2D Transformations (cont.) 3. Additivity of successive rotations where Slide 18: Composition of 2D Transformations (cont.) 4. Different types of elementary transformations discussed above can be concatenated as well. where Slide 19: Consider the following two questions: translate a line segment P1 P2, say, by -1 units in the x direction and -2 units in the y direction. 2). Rotate a line segment P1 P2, say by ? degrees counter clockwise, about P1. P1(1,2) P2(3,3) P’2 P’1 P1(1,2) P2(3,3) P’2 P’1 ? Slide 20: Other Than Point Transformations… Translate Lines: translate both endpoints, then join them. Scale or Rotate Lines: More complex. For example, consider to rotate an arbitrary line about a point P1, three steps are needed: 1). Translate such that P1 is at the origin; 2). Rotate; 3). Translate such that the point at the origin returns to P1. ? Slide 21: Another Example. Scale Translate Rotate Translate Slide 22: Order Matters! As we said, the order for composition of 2D geometrical transformations matters, because, in general, matrix multiplication is not commutative. However, it is easy to show that, in the following four cases, commutativity holds: 1). Translation + Translation 2). Scaling + Scaling 3). Rotation + Rotation 4). Scaling (with sx = sy) + Rotation just to verify case 4: if sx = sy, M1 = M2. Slide 23: Rigid-Body vs. Affine Transformations A transformation matrix of the form where the upper 2?2 sub-matrix is orthogonal, preserves angles and lengths. Such transforms are called rigid-body transformations, because the body or object being transformed is not distorted in any way. An arbitrary sequence of rotation and translation matrices creates a matrix of this form. The product of an arbitrary sequence of rotation, translations, and scale matrices will cause an affine transformation, which have the property of preserving parallelism of lines, but not of lengths and angles. Slide 24: Rigid-Body vs. Affine Transformations (cont.) Shear transformation is also affine.