<< 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 consider the storage and manipulation of three-dimensional objects. We will continue to use homogeneous coordinates so that translation can be included in composite operators. Homogeneous coordinates in threedimensions will also allow us to do perspective projections so that we can view a three-dimensional object from any point in space.

Image Representation. The three-dimensional form of the point matrix in homogeneous coordinates is

G = x 1 x 2 x 3 ... x n y l y 2 y 3 ... y n z 1 z 2 z 3 ... z n 1 1 1 ... 1 R 4 × n .

The line matrix H is exactly as before, pointing to pairs of columns in G to connect with lines. Any other grouping matrices for objects, etc., are alsounchanged.

Image manipulations are done by a 4 × 4 matrix A. To ensure that the fourth coordinate remains a 1, the operator A must have the structure

A = a 11 a 12 a 13 a 14 a 21 a 22 a 23 a 24 a 31 a 32 a 33 a 34 0 0 0 1 .

The new image has point matrix

G n e w = A G .

Left- and Right-Handed Coordinate Systems. In this book we work exclusively with right-handed coordinate systems. However, it is worth pointing out that there are two ways to arrange the axes in three dimensions. Figure 1(a) shows the usual right-handed coordinates, and the left-handed variation is shown in Figure 1(b) . All possible choices of labels x , y , and z for the three coordinate axes can be rotated to fit one of these two figures, but no rotation will go from one to the other.

Figure one contains two three-dimensional coordinate systems, showing the difference between the right-handed and left-handed methods of representing objects in three dimensional space. Part a, or the right-handed method, shows an axis pointing towards the reader labeled, x, an axis pointing to the right labeled y, and an axis pointing up labeled z. Part b, or the left-handed method, shows an axis pointing towards the reader labeled y, an axis pointing to the right labeled x, and an axis pointing up labeled z. Figure one contains two three-dimensional coordinate systems, showing the difference between the right-handed and left-handed methods of representing objects in three dimensional space. Part a, or the right-handed method, shows an axis pointing towards the reader labeled, x, an axis pointing to the right labeled y, and an axis pointing up labeled z. Part b, or the left-handed method, shows an axis pointing towards the reader labeled y, an axis pointing to the right labeled x, and an axis pointing up labeled z.
Three-Dimensional Coordinate Systems; (a) Right-handed, and (b) Left-handed

Be careful to sketch a right-handed coordinate system when you are solving problems in this chapter. Some answers will not be the same for aleft-handed system.

Image Transformation. Three-dimensional operations are a little more complicated than their two-dimensional counterparts. For scaling andtranslation we now have three independent directions, so we generalize the operators of Equation 10 from "Vector Graphics: Homogeneous Coordinates" as

S ( s x , s y , s z ) = s x 0 0 0 0 s y 0 0 0 0 s z 0 0 0 0 1 T ( t x , t y , t z ) = 1 0 0 t x 0 1 0 t y 0 0 1 t z 0 0 0 1 .

Rotation may be done about any arbitrary line in three dimensions. We will build up to the general case by first presenting the operators that rotateabout the three coordinate axes. R x ( θ ) rotates by angle θ about the x-axis, with positive θ going from the y-axis to the z-axis, as shown in Figure 2 . In a similar fashion, positive rotation about the y-axis using R y ( θ ) goes from z to x , and positive rotation about the z-axis goes from x to y , just as in two dimensions. We have the fundamental rotations

R x ( θ ) = 1 0 0 0 0 c o s θ - s i n θ 0 0 s i n θ c o s θ 0 0 0 0 1 R y ( θ ) = c o s θ 0 s i n θ 0 0 1 0 0 - s i n θ 0 c o s θ 0 0 0 0 1 R z ( θ ) = c o s θ - s i n θ 0 0 s i n θ c o s θ 0 0 0 0 1 0 0 0 0 1 .

A more general rotation about any line through the origin can be constructed by composition of the three fundamental rotations. Finally, by composingtranslation with the fundamental rotations, we can build an operator thatrotates about any arbitrary line in space.

Figure two shows three right-handed three-dimensional graphs showing possible directions of positive rotation. The first shows an arc rotating the y-axis towards the z-axis in a counter-clockwise direction. The arc is labeled R_x (θ). the second shows an arc rotating the z-axis towards the x-axis, moving towards the reader, or looking from the right, in a counter-clockwise direction. The arc is labeled R_y (θ). The third shows an arc rotating the x-axis towards the y-axis, which, looking from above, would be in a counter-clockwise direction. The arc is labeled R_z (θ). Figure two shows three right-handed three-dimensional graphs showing possible directions of positive rotation. The first shows an arc rotating the y-axis towards the z-axis in a counter-clockwise direction. The arc is labeled R_x (θ). the second shows an arc rotating the z-axis towards the x-axis, moving towards the reader, or looking from the right, in a counter-clockwise direction. The arc is labeled R_y (θ). The third shows an arc rotating the x-axis towards the y-axis, which, looking from above, would be in a counter-clockwise direction. The arc is labeled R_z (θ).
Directions of Positive Rotation

To rotate by angle φ about the line L , which lies in the x - y plane in Figure 3 , we would

  1. rotate L to the x-axis with R z ( - θ ) ;
  2. rotate by φ about the x-axis with R x ( φ ) ; and
  3. rotate back to L with R z ( θ ) .

The composite operation would be

A ( θ , φ ) = R z ( θ ) R x ( φ ) R z ( - θ ) .
Figure three shows a right-handed three-dimensional graph that contains a line L pointing below the x-y plane. The angle from L to the positive x-axis is measured and labeled θ. Around the line L is an arrow describing rotation about the line, and it is labeled Φ. Figure three shows a right-handed three-dimensional graph that contains a line L pointing below the x-y plane. The angle from L to the positive x-axis is measured and labeled θ. Around the line L is an arrow describing rotation about the line, and it is labeled Φ.
Composition of Rotations

Direction Cosines. As discussed in the chapter on Linear Algebra , a vector v may be specified by its coordinates ( x , y , z ) or by its length and direction. The length of v is | | v | | , and the direction can be specified in terms of the three direction cosines ( cos θ x , cos θ y , cos θ z ). The angle θ x is measured between the vector v and the x-axis or, equivalently, between the vector v and the vector e x = [ 100 ] T . We have

cos θ x = ( v , e x ) | | v | | | | e x | | = x | | v | |

Likewise, θ y is measured between v and e y = [ 010 ] T , and θ z is measured between v and e z = [ 001 ] T . Thus

cos θ y = y | | v | | cos θ z = z | | v | |

The vector

u = cos θ x cos θ y cos θ z

is a unit vector in the direction of v , so we have

v = | | v | | u = | | v | | cos θ x cos θ y cos θ z .

The direction cosines are useful for specifying a line in space. Instead of giving two points P 1 and P 2 on the line, we can give one point P 1 plus the direction cosines of any vector that points along the line. One such vector isthe vector from P 1 to P 2 .

Arc tangents. Consider a vector v = x y in two dimensions. We know that

tan θ = y x

for the angle θ shown in Figure 4 . If we know x and y , we can find θ using the arc tangent function

θ = tan - 1 ( y x ) .
Figure four displays a two-dimensional cartesian graph with labeled quadrants I, II, III, and IV, and a line segment pointing from the origin to a point V in the first quadrant. The angle from the line segment to the x-axis is labeled θ. A dashed line drawn horizontally from point V to its vertical value on the y-axis is labeled y, and a dashed line drawn vertically from point V to its horizontal value on the x-axis is labeled x. Figure four displays a two-dimensional cartesian graph with labeled quadrants I, II, III, and IV, and a line segment pointing from the origin to a point V in the first quadrant. The angle from the line segment to the x-axis is labeled θ. A dashed line drawn horizontally from point V to its vertical value on the y-axis is labeled y, and a dashed line drawn vertically from point V to its horizontal value on the x-axis is labeled x.
Tangent and Arc Tangent

In MATLAB,

Unfortunately, the arc tangent always gives answers between - π 2 and π 2 corresponding to points v in quadrants I and IV. The problem is that the ratio - y - x is the same as the ratio - - - x A so quadrant III cannot be distinguished from quadrant I by the ratio y x Likewise, quadrants II and IV are indistinguishable.

The solution is the two-argument arc tangent function. In MATLAB,

will give the true angle θ - π and π in any of the four quadrants.

Consider the direction vector u = c o s θ x c o s θ y c o s θ z , as shown in Figure 5 . What is the angle φ y between the projection of u into the x - y plane and the y-axis? This is important because it is R z ( φ y ) that will put u in the y - z plane, and we need to know the angle φ y in order to carry out this rotation. First note that it is not the same as θ y . From the geometry of the figure, we can write

tan φ y = cos θ x cos θ y

This gives us a formula for φ y in terms of the direction cosines of u . With the two-argument arc tangent, we can write

φ y = tan - 1 ( cos θ x , cos θ y ) .
Figure five shows a right-handed three-dimensional graph with one arrow labeled u pointed towards the reader in a positive x, y, and z direction. there are four dashed line segments. The first is a line directly downward from u's highest point to a spot below on the x-y plane. The second is a projection of u onto the x-y plane, or in other words, a dashed line from the origin to the spot on the x-y plane directly below u's highest point. The third and fourth come from that same spot and make a rectangle on the x-y plane by connecting this spot directly to the y-axis and perpendicularly to the x-axis. The ends of these two line segments are labeled cos θ_y and cos θ_x on their respective axes. There are also numerous arcs measuring angles from u to the axes and some of the dashed line segments. One arc from u to the x-axis is labeled θ_x. Another measures the angle projected line segment under u to the y-axis, and is labeled Φ_y. A third measures the angle from u to the positive z-axis and is labeled θ_z. A final arc measures from the y-axis to u and is labeled θ_y. Figure five shows a right-handed three-dimensional graph with one arrow labeled u pointed towards the reader in a positive x, y, and z direction. there are four dashed line segments. The first is a line directly downward from u's highest point to a spot below on the x-y plane. The second is a projection of u onto the x-y plane, or in other words, a dashed line from the origin to the spot on the x-y plane directly below u's highest point. The third and fourth come from that same spot and make a rectangle on the x-y plane by connecting this spot directly to the y-axis and perpendicularly to the x-axis. The ends of these two line segments are labeled cos θ_y and cos θ_x on their respective axes. There are also numerous arcs measuring angles from u to the axes and some of the dashed line segments. One arc from u to the x-axis is labeled θ_x. Another measures the angle projected line segment under u to the y-axis, and is labeled Φ_y. A third measures the angle from u to the positive z-axis and is labeled θ_z. A final arc measures from the y-axis to u and is labeled θ_y.
Angles in Three Dimensions

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