<< Chapter < Page Chapter >> Page >
This module is part of the collection, A First Course in Electrical and Computer Engineering . The LaTeX source files for this collection were created using an optical character recognition technology, and because of this process there may be more errors than usual. Please contact us if you discover any errors.

We now turn our attention to operating on the point matrix G to produce the desired transformations. We will consider

  1. rotation
  2. scaling
  3. and translation (moving) of objects
. Rotation and scaling are done by matrix multiplication with a square transformation matrix A. If we call thetransformed point matrix G n e w , we have

[ G n e w ] = [ A ] [ G ] .

We call A a matrix operator because it “operates” on G through matrix multiplication. In contrast, translation must be done by matrix addition.

In a later section you will see that it is advantageous to perform all operations by matrix operators and that we can modify our image representation to allow translation to be done with a matrix operator like rotation andscaling. We will call the modified representation homogeneous coordinates .

Rotation. We saw in the chapter on linear algebra that the matrix that rotates points by an angle θ is

A = R ( θ ) = c o s θ - s i n θ s i n θ c o s θ .

When applied to the point matrix G , this matrix operator rotates each point by the angle θ , regardless of the number of points.

We can use the rotation matrix to do the single point rotation of the example from "Vector Graphics: Introduction" . We have a point matrix consisting of only the point ( 3 , 1 ) :

G = 3 1 .

The necessary transformation matrix is R ( θ ) with θ = π 6 Then the rotated point is given by

G n e w = R ( π 6 ) G = c o s ( π 6 ) - s i n ( π 6 ) s i n ( π 6 ) c o s ( π 6 ) 3 1 2 . 10 2 . 37 ·

Scaling. An object can be enlarged or reduced in each dimension inde- pendently. The matrix operator that scales an image by a factor of s x along the x-axis and s y along the y-axis is

A = S ( s x , s y ) = s x 0 0 s y .

Most often we take s x = s y to scale an image by the same amount in both dimensions.

Translation. An object can be moved by adding a constant vector b to every point in the object. For example, b = 20 - 5 will move an object 20 units to the right and 5 units down. We can write this in terms of the point matrix as

G n e w = G + b 1 T

where 1 (read “the one-vector”) is a vector of n l's:

1 = 1 1 1 .

In MATLAB, 1 may be obtained by. The outer product of b with 1 in Equation 7 simply serves to make n copies of b so that one copy can be added to each point in G . ones(n,1)

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, A first course in electrical and computer engineering. OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10685/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A first course in electrical and computer engineering' conversation and receive update notifications?

Ask