Anda di halaman 1dari 9

Lecture 3 Lines in plane. Two dimensional transformations - rotation, translation.

Combined transformations
3.1. POINTS AND VECTORS

Real life methods for constructing curves and surfaces often start with points and vectors, which is why we start with a short discussion of the properties of these mathematical entities. The material in this section applies to both two-dimensional and three-dimensional points and vectors, while the examples are given in two-dimensions. Points and vectors are different mathematical entities. A point has no dimensions; it represents a location in space. A vector, on the other hand, has no well-defined location and its only attributes are direction and magnitude. People tend to confuse points and vectors because it is natural to associate a point P with the vector v that points from the origin to P (Figure 3.1a). This association is useful, but the reader should bear in mind that P and v are different.

Figure 3.1. Operations on points Both points and vectors are represented by pairs or triplets of real numbers, but these numbers have different meanings. A point with coordinates (3, 4) is located 3 units to the right of the y axis and 4 units above the x axis. A vector with components (3, 4), however, points in direction 4/3 (it moves 3 units in the x direction for every 4 units in the y direction, so its slope is 4/3) and its magnitude is 32 + 4 2 = 5 . It can be located anywhere. In mathematics, entities are always associated with operations. An entity that cannot be operated on is generally not useful. Thus, we discuss operations on points and vectors. The first operation is to multiply a point P by a real number . The product P is a point on the line connecting P to the origin (Figure 3.1b). Note that this line is infinite and P can be located anywhere on it, depending on the value of . The next operation is subtracting points. Let P0 = (x0, y0) and P1 = (x1, y1) be two points. The difference P1 P0 = (x1 x0, y1 y0) = (x,y) is well defined. It is the vector (the direction and distance) from P0 to P1 (Figure 3.1b). Example: The two points P0 = (5, 4) and P1 = (2, 6) are subtracted to produce the pair P1 P0 = (2 5 =3, 6 4= 2). The new pair is a vector, because it represents a direction and a distance. To get from P0 to P1, we need to move 3 units in the x direction and 2 units in the y direction. 1

Similarly, P0 P1 is the direction from P1 to P0. The distance between the points is These properties do not depend on the particular coordinate axes used. 3.2. EQUATIONS OF STRAIGHT LINES

(3) 2 + 2 2 .

The equations of line can take various forms depending on the facts we know about the lines. So to start, suppose we have a straight line
3.2.1. Line trough origin with a given gradient

Suppose we have a line with equation y = x. Then for every point on the line, the y coordinate must be equal to the x coordinate. So the line will contain points in the following list. (Fig. 3.2) We can find the gradient of the line using the formula for gradients, y y m= 2 1 x2 x1 and substituting in the first two sets of values from the table. We get 1 0 m= =1 Figure 3.2. Line y = x 1 0 so that the gradient of this line is 1.
The equation of a straight line with gradient m passing through the origin is given by y = mx
3.2.2. The y-intercept of a line

Consider the straight line with equation y = 2x+1. This equation is in a slightly different form from the previous one. Calculated values and the drawing is shown on Figure 3.3 Notice that when x = 0 the value of y is 1. So this line cuts the y-axis at y = 1. The general equation of a straight line is y = mx + c, where m is the gradient, and y = c is the value where the line cuts the y-axis. This number c is called the intercept on the y-axis.
3.2.3. Line with given gradient, passing through a given point

Figure 3.3. Line y =mx+c

Example: Suppose that we want to find the equation of a line which has a gradient of 1/3 and passes through the point (1, 2). Here, whilst we know the gradient, we do not know the value of the y-intercept c. We start with the general equation of a straight line y = mx + c. We know the gradient is 1/3 and so we can substitute this value for m straightaway. This gives
2

1 x+c 3 We now use the fact that the line passes through (1, 2). This means that when x = 1, y must be 2. Substituting these values we find 1 1 5 2 = (1) + c so that c = 2 = 3 3 3 y=

So the equation of the line is y =

1 5 x+ 3 3

We can work out a general formula for problems of this type by using the same method. We shall take a general line with gradient m, passing through the fixed point P1(x1, y1). We start with the general equation of a straight line y = mx + c. We now use the fact that the line passes through P1(x1, y1). This means that when x = x1, y must be y1. Substituting these values we find
y1 = mx1 + c

so that

c = y1 mx1

So the equation of the line is y = mx + y1 mx1 . We can write this in the alternative form
y y1 = m( x x1 )

3.2.4. Straight line through two given point

Let we have two points (1, 2) and (2, 4) and we want to find the equation of a straight line which passes through them. Here we dont know the gradient of the line but we know two points on the line, and so we can use them to work out the gradient. We just use the formula m = ( y2 y1 ) /( x2 x1 ) . We get 42 2 m= = 2 (1) 3 So the gradient of the line is 2/3. And we know two points on the line, so we can use one of them in the formula y y1 = m( x x1 ) . If we take the point (2, 4) we get 2 y 4 = ( x 2); 3 3 y 12 = 2 x 4 3y = 2x + 8 2 8 y = x+ 3 3
As before, it will be useful to find a general formula that can be used for examples of this kind. So suppose the general line passes through two points A(x1, y1) and B(x2, y2). We shall let a general point on Figure 3.4. Line through two given points the line be P(x, y) (See Fig. 3.4). Now we know that the gradient of AP must be the same as the gradient of AB, as all three points are on the same line. But the gradient of AP is y y1 y y1 m AP = , whereas the gradient of AB is m AB = 2 . Then mAP = mAB, so we must have x x1 x2 x1

y y1 y2 y1 = x x1 x2 x1
Now this formula is fairly complicated, but it is easier to remember if all the terms involving y are on one side, and all the terms involving x are on the other. If we manipulate the formula, we get first y y1 y y1 = ( x x1 ) 2 and then x2 x1 y y1 x x1 = y2 y1 x2 x1

It might help you to remember this formula if you notice that the pattern on the left-hand side, involving y, is just the same as the pattern on the right-hand side, involving x.
3.2.5. The most general equation of a straight line

There is one more form of the equation for a straight line that is sometimes needed. This is the equation Ax + By + C = 0 We can see some special cases of this equation by setting either A or B equal to zero. If A = 0 then we obtain lines with general equation By + c = 0, i.e. y = C/B. These lines are horizontal, so that they are parallel to the x-axis. If B = 0 then we obtain lines with general equation Ax + C = 0, i.e. x = C/A. These lines are vertical, so that they are parallel to the y-axis. The equation of a vertical line cannot be written in the form y = mx+c. The equation Ax+By+C = 0 is the most general equation for a straight line, and can be used where other forms of equation are not suitable. We can transfer the general formula to the form y = mx + c (see Figure 3.5). Let start with Ax+By = -C. When x = 0 then y = -C/B and when y=0 then x = -C/A. We get that intercept c = -C/B. The slope m is
m= C A A = BC B

Ax+By+C = 0

c=-C/B

= -C/A
Figure 3.5. General form of line 3.2.6. Determinant method of founding a line through two points

On the previous sections, we gave several standard methods for defining lines, or that go through two points, etc. All these examples were limited to two dimensions. A more general method of finding a line that goes through two points is the Determinant Method, which is presented here. If we have two points P1 (x1,y1) and P2 (x2,y2) the equation of the line can be obtained after the solving of the following equation that include a determinant.

x x1 x2

y1 1 = 0 y2 1

Calculation of determinant (Reminder). The determinant of 3 x 3 matrix is calculated as follows:


c a b c a b e f det(A) = d e f d e = h i g h i g h = a.e.i + b. f .g + c.d .h g .e.c h. f .a i.d .b Example: Find the equation if the line through the points P1(1,2) and P2(3,3) using determinant method. First, we will obtain the equation of the line by other method. b a A= d g

1 3 1 y y1 x x1 y 2 x 1 = = y 2 = ( x 1) y = x + 2 2 2 y2 y1 x2 x1 3 2 3 1 Now, we use the determinant method: x y 1 1 3 det( A) = 1 2 1 = 0 2 x + 3 y + 3 6 3 x y = 0 2 y = x + 3 y = x + 2 2 3 3 1


3.2.7. Section of two lines

Let consider the situation when we have two lines every one defined by two points. The task is to find the co-ordinates of the intersection point S (see Fig. 3.6). We can write the equations of the both lines: Line 1: y = m1 x + c1 Line 2: y = m2 x + c2 The point S lies on Line 1 an Line 2, so that m1 xs + c1 = m2 xs + c2 xs =

P3(x3,y3) S(xs,ys) P1(x1,y1)

P2(x2,y2)

P3(x3,y3) Figure 3.6. Section of lines

c2 c1 ; ys = m1 xs + c1 m1 m2

Example: Let have fore points P1(1,1), P2(4,4), P3(4,1) and P4(0,3). Find the co-ordinates of intersection point.
Line 1: m1 =

y2 y1 ; c1 = y1 x1m1 x2 x1 4 1 m1 = = 1; c1 = 1 1.1 = 0 4 1 y4 y3 ; c 2 = y3 x3m2 x4 x3

Line 2: m2 =

m2 =

3 1 1 1 = ; c 2 = 1 + 4. = 3 04 2 2

After substitution for co-ordinates of S we get: 30 xs = = 2; ys = 1.2 + 0 = 2 - intersection point S(2,2). 1 (1 / 2)


3.3. ROTATION IN TWO DIMENSIONS

Consider a rigid body S packed with points Pi (i = 1, , n) and let a point Pj (xj, yj) on S be rotated about the z-axis * to Pj* ( x* j , y j ) by an angle . From Figure 3.7, it can be observed that x* j = l cos( + ) = l cos cos l sin sin
= x j cos y j sin

y = l sin( + ) = l cos sin + l sin cos


* j

= x j sin + y j cos Or in matrix form


Figure 3.7. Rotation in a plane x x* cos sin j j * * = y P j = RP j ( 3.1) where sin cos j yj cos sin R= is the two-dimensional rotation matrix. For S to be rotated by an angle , sin cos transformation in Eq. (3.1) must be performed simultaneously for all points Pi (i = 1, . . . , n) such that the entire rigid body reaches the new destination S*.

Example. A trapezoidal lamina ABCD lies in the x-y plane as shown with A(6, 1), B(8, 1), C(10, 4) and D(3, 4). The lamina is to be rotated about the z-axis by 90. Determine the new position A*B*C*D* after rotation (Figure 3.8). The transformation matrix R is given by Eq. (3.1) with = 90. Thus,
A* A 6 * B B = R = cos 90 sin 90 8 sin 90 cos 90 10 C * C * D D 3
T T

1 1 4 4

Figure 3.8. Rotation example

6 0 1 8 = 1 0 10 3

1 1 6 1 8 1 = 4 10 4 4 4 3

3.4.

TRANSLATION IN TWO DIMENSIONS. HOMOGENEOUS COORDINATES

For a rigid body S to be translated along a vector v such that each point of S shifts by (p, q), x j p x* j * x = x j + p, y = y j + q * = + Pj = P j + v y j q yj
* j * j

(3.2)

Example. For a planar lamina ABCD with A(3,5), B(2,2), C(8, 2) and D(4, 5) in x-y plane and 8 P(4,3) a point in the interior, the lamina is to be translated through v = . Eq. (3.2) yields 5
T

A* 3 5 8 * 2 2 8 B C * = 8 2 + 8 * D 4 5 8 P* 8 4 3

5 11 10 10 7 5 5 = 16 7 5 12 10 5 12 8

Figure 3.9. Translation We may note that like rotation, translation as in Eq. (3.2) does not work out to be a matrix multiplication. Instead, it is the addition of a point (position vector) and a (free) vector. One may attempt to represent translation also in the matrix multiplication form to unify the procedure for rigid body transformations. Consider Eq. (3.2) rewritten as
x* 1 0 p x j x j + p j * y j = 0 1 q y j = y j + q 1 1 1 0 0 1

(3.3)

Here, the first two rows provide the translation information while the third row gives the xj dummy result 1 = 1. Note also that the definition of position vector P j = is altered from an yj
xj ordered pair in the two-dimensional space to an ordered triplet y j which is termed as the 1 homogenous coordinates of Pj. We may use this new definition of position vectors to express translation in Eq. (2.3) as P* j = TP j where p q 1 The rotation relation in Eq. (3.1) can be modified as well to express the result in terms of the homogeneous coordinates, that is 1 0 T= 0 1 0 0

x* cos j * P* j = RP j y j = sin 1 0

sin cos 0

0 x j cos 0 y j where R = sin 1 1 0

sin
cos 0

0 0 1

(3.4)

Rigid body translation and rotation thus get unified as matrix multiplication operations only, involving no addition or subtraction of matrices and vectors. Further, one can concatenate a sequence of transformations, for instance, translation of an object followed by its rotation. If one can identify the matrices for each of these transformations in the multiplication form, it becomes much easier to track the intermediate positions as well as to predict the final transformed position of the rigid body. 3.5. COMBINED ROTATION AND TRANSLATION

Consider a point P(x,y,1) in the x-y plane to be rotated by an angle about the z-axis to a position P1 (x1,y1,1) followed by a translation by v (p,q) to a position P2 (x2, y2, 1). Using Eqs. (3.3) and (3.4), we may write x1 cos sin 0 x P1 = RP, y1 = sin cos 0 y 0 1 0 1 1
x 2 1 and P2 = TP1 , y 2 = 0 0 1 cos sin Thus, P2 = sin cos 0 0 p x1 1 0 1 q y1 = 0 1 0 1 0 0 1 p x q y = TRP 1 1
0

p cos q sin 1 0

sin
cos 0

0 x 0 y = TRP 1 1

(3.5)

On the contrary, if translation by v is followed by rotation about the z-axis by an angle to * , then reach P2 cos sin 0 1 0 p x cos sin ( p cos q sin ) x * (3.6) P2 = RTP = sin cos 0 0 1 q y = sin cos ( p sin + q cos ) y 0 1 0 1 0 1 0 0 0 1 1
* are not identical. We observe from Eqs. (3.5) and (3.6) that the final positions P2 and P2 From above we can arrive at two important conclusions: (a) the homogeneous coordinate system helps to unify translation and rotation as multiplicative transformations and (b) transformations are not commutative. The sequence in which the transformations are performed is significant and must be maintained while concatenating the respective matrices. Otherwise a different orientation or position of the object is reached. If T1, T2, , Tn are the transformations to be performed in the order, the combined transformation matrix T is given as T = Tn Tn1 Tn2 T2 T1.

Example. Lamina ABCD with coordinates (1, 1), (4, 1), (2, 3), (1, 3) and is first rotated through 45 and then translated by (2, 3). In another sequence, the trapezoid is first translated by (2, 3) and then rotated through 45. The lamina acquires different positions and orientations given and shown below for the two sequences of transformations. For rotation and then translation using Eq. (3.5), we have

A* 1 1 1 2.000 cos 45 sin 45 2 * B = sin 45 cos 45 3 4 1 1 = 4.121 2 3 1 C * 1.293 0 0 1 * 1 3 1 D 0.586

4.414 1 6.536 1 6.536 1 5.828 1

For translation and then rotation Eq. (3.6) gives


A* 1 cos 45 sin 45 (2 cos 45 3 sin 45) * B = sin 45 cos 45 (2 sin 45 + 3 cos 45) 4 2 C * 0 1 * 0 1 D
T

1 1 0.707 1.414 1 1 = 1.414 3 1 3 1 2.121

4.950 1 7.071 1 7.071 1 6.364 1

The two different laminar positions and orientations are shown in Figure 3.10.
8
8

II, translation
4
4

II, rotation

I, rotation
2
2

I, translation

0 -4 -2 0 2 4 6

0 -4 -2 0 2 4 6

Figure 3.10. An example depicting the significance of order in transformations