<< 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.

Often we will want to perform several operations on an object before we display the result. For example, suppose we want to rotate by π 3 and reduce to 1 2 size in each dimension:

G 1 = R ( π 3 ) G G n e w = S ( 1 2 , 1 2 ) G 1 .

If there are n points in the matrix G , it will require 4 n multiplications to perform each of these operations, for a total of 8 n multiplications. However, we can save some multiplications by noting that

G n e w = S ( 1 2 , 1 2 ) [ R ( π 3 ) G ] = A G

where

A = S ( 1 2 , 1 2 ) R ( π 3 ) = 1 2 c o s ( π 3 ) - 1 2 s i n ( π 3 ) 1 2 s i n ( π 3 ) l 2 c o s ( π 3 ) .

In other words, we take advantage of the fact that matrix multiplication is associative to combine S and R into a single operation A , which requires only 8 multiplications. Then we operate on G with A , which requires 4 n multiplications. By “composing” the two operations, we have reduced the total from 8 n to 4 n + 8 multiplications. Furthermore, we can now build operators with complex actions by combining simple actions.

We can build an operator that stretches objects along a diagonal line by composing scaling and rotation. We must

  1. rotate the diagonal line to the x-axis with R ( - θ ) ;
  2. scale with S ( s , 1 ) ; and
  3. rotate back to the original orientation with R ( θ ) .

Figure 1 shows a square being stretched along a 45 o line. The composite operator that performs this directional stretching is

A ( θ , s ) = R ( θ ) S ( s , 1 ) R ( - θ ) = c o s θ - s i n θ s i n θ c o s θ s 0 0 1 c o s θ s i n θ - s i n θ c o s θ = s c o s 2 θ + s i n 2 θ ( s - 1 ) s i n θ c o s θ ( s - 1 ) s i n θ c o s θ c o s 2 θ + s s i n 2 θ .

Note that the rightmost operator in a product of operators is applied first.

Figure one is a series of three two-dimensional graphs displaying the rotations of a square. In the first graph, the square is sitting on the x and y-axis with one vertex at the origin, and a dashed diagonal line labeled 45° indicates a rotation about the line y=x. An arc labeled rotate -π/4 describes the rotation. The second graph shows a square laid diagonally along the x-axis, with one vertex at the origin, and the opposite vertex at a positive spot on the x-axis. The third and fourth vertices lay at a 45 degree angle positively and negatively from the origin. An arrow to the right of the square is labeled, scale. The third is a distorted quadrilateral sitting in the same place as the second square, but slightly stretched horizontally to the right. An arc is labeled, rotate, π/4. The fourth is a shape of the same distortion of that of the third graph, now rotated back to closely resemble the position of the square in the first graph, except that since it is a distorted shape, its vertices are located slightly above and to the right of the original vertices in the shape in the first graph. Figure one is a series of three two-dimensional graphs displaying the rotations of a square. In the first graph, the square is sitting on the x and y-axis with one vertex at the origin, and a dashed diagonal line labeled 45° indicates a rotation about the line y=x. An arc labeled rotate -π/4 describes the rotation. The second graph shows a square laid diagonally along the x-axis, with one vertex at the origin, and the opposite vertex at a positive spot on the x-axis. The third and fourth vertices lay at a 45 degree angle positively and negatively from the origin. An arrow to the right of the square is labeled, scale. The third is a distorted quadrilateral sitting in the same place as the second square, but slightly stretched horizontally to the right. An arc is labeled, rotate, π/4. The fourth is a shape of the same distortion of that of the third graph, now rotated back to closely resemble the position of the square in the first graph, except that since it is a distorted shape, its vertices are located slightly above and to the right of the original vertices in the shape in the first graph.
Rotating and Scaling for Directional Stretching

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