Documente Academic
Documente Profesional
Documente Cultură
GEOMETRICAL TRANSFORMATIONS
The Transformations are used directly by Application Programs and within many graphics subroutine packages. 2D TRANSFORMATIONS : The points in the (x, y) plane can be translated 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'), which can be written as:x= x + dx , y = y + dy -------------------- (5.1)
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 2
=P+T=
3 October 2013
Scaling of a house: The scaling is non uniform, and the house changes position.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 5
Here = 45o
3 October 2013
3 October 2013
The matrix representations for Translation, Scaling, and Rotation are given respectively as follows: P' = T + P -------------------------(5.3) P' = S P -------------------------(5.5) P' = R . P -------------------------(5.7) But, Translation is treated differently (as an addition) from Scaling and Rotation (as multiplications). If points are expressed in Homogeneous Coordinates, then all the 3 transformations can be treated as multiplications.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 8
In homogeneous coordinates, a 3rd coordinate is added to a point. Thus a pair of numbers (x, y), is represented by a triple (x, y, W). Also, two sets of homogeneous coordinates (x, y, W) and (x', y', W') represent the same point if and only if one is a multiple of the other. e.g.: Thus, (2, 3, 6) and (4, 6, 12) are the same points represented by different coordinate Triples. Also, at least one of the homogeneous coordinates must be nonzero: (0, 0, 0) is not allowed. If the coordinate W 0, then (x, y, W) can be divided through by W representing the same point as (x/W, y/W, 1), and the numbers x/ W and y/W are called the Cartesian coordinates of the homogeneous point. The points with W = 0 are called points at infinity.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 9
Triples of coordinates represent points in 3D-space, but here Triples are being used to represent points in 2D-space. lf all the triples are taken, representing the same point i.e. all triples of the form (tx, ty, tW), with t 0 then a line in 3D-space is obtained. Thus, each homogeneous point represents a line in 3D-space. If the point is homogenized (divide by W), a point of the form (x, y, 1) is obtained. Thus, the homogenized points form the plane defined by the equation W = 1 in (x, y, W)-space. The adjacent Figure shows this relationship.
The XYW homogeneous coordinate space, with the W = 1 plane and point P(X, Y, W) projected onto the W = 1 plane.
3 October 2013
10
3 October 2013
11
3 October 2013
12
3 October 2013
13
3 October 2013
14
When the product of an arbitrary sequence of Rotation, Translation, and Scale matrices are considered then such transformations are called Affine Transformations(AT), and ATs have the property of preserving parallelism of lines but not lengths and angles. Figure 5.6 shows the results of applying a - 45 rotation and then a non uniform scaling to the unit cube.
In the adjacent figure a unit cube is rotated by 45 and is non uniformly scaled. The result is an Affine Transformation of the unit cube, in which parallelism of lines is maintained, but neither angles nor lengths are maintained.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 15
Another type of primitive Transformation, shear Transformations, are also affine. 2D Shear transformations are of two kinds: a Shear along the x axis and a Shear along the y axis. Figure 5.7 shows the effect of shearing the unit cube along each axis. The operation is represented by the matrix
The term a in the shear matrix is the proportionality constant. Note: The product SHx.[x y 1]T is [x+ay y 1]T, clearly demonstrating the proportional change in x as a function of y.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 16
3 October 2013
17
COMPOSITION OF 2D TRANSFORMATIONS
Consider the rotation of an object about some arbitrary point P1. As it is known, how to rotate only about the origin, the original (difficult) problem is converted into three separate (easy) problems. Thus, to rotate about P1, a sequence of three fundamental transformations are needed: Z. Translate such that P1, is at the origin 2. Rotate 3. Translate such that the point at the origin returns to P1. This sequence is illustrated in Fig. 5.8, in which our house is rotated about P1(x1, y1). The first translation is by (-x1, - y1), whereas the later translation is by the inverse (x1, y1).
3 October 2013
18
Example
3 October 2013
19
3 October 2013
20
EFFICIENCY
The most general composition of R, S, and T operations produces a matrix of the form:
The upper 2 x2 sub matrix is a composite Rotation and Scale matrix, whereas tx and ty, are composite Translations. Calculating M P as a vector multiplied by a 3 X 3 matrix takes nine multiplies and six adds. The fixed structure of the last row of Eq. (5.35), simplifies the actual operations to reducing the process to four multiplies and four adds which is a significant speedup.
3 October 2013
21
EFFICIENCY contd.
Another area where efficiency is important is creating successive views of an object, such as a molecule or airplane, rotated a few degrees between each successive view. If each view can be created and displayed quickly enough (30 to 100 milliseconds each), then the object will appear to be rotating dynamically. To achieve this speed, each individual point and line of the object must be transformed as quickly as possible. The rotation equations (Eq. 5.6) require four multiplies and two adds, this operation count can be decreased by observing that cos is very close to 1, because is small (just a few degrees). In this approximation, Eq. (5.6) becomes x' = x - y sin, y' = x sin + y (5.37) which requires just two multiplies and two adds.
The savings of two multiplies can be significant on computers lacking hardware multipliers.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 22
EFFICIENCY contd.
Equation (5.37), however, is only an approximation to the correct values of x and y; but a small error is built in.
This is a better approximation than is Eq. (5.37) because the determinant of the corresponding 2 X 2 matrix is 1, which means that the areas transformed by Eq. (5.38) are unchanged. Note: Cumulative errors can also arise when using the correct rotation equations repeatedly .
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 23
As in 2D, a standard representation of a point (x, y, z, W) with W 0 is given by (x/W, y/W, z/W, 1). Transforming the point to this form is called homogenizing.
Also, points whose W coordinate is zero are called Points at Infinity.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 24
3 October 2013
25
3 October 2013
26
3 October 2013
27
The columns (and the rows] of the upper left 3 X 3 submatrix of Rz(), Rx(), and Ry() are mutually perpendicular unit vectors and the submatrix has a determinant of 1, which means the three matrices are special orthogonal. Also, the upper-left 3 X 3 submatrix formed by an arbitrary sequence of rotations is special orthogonal. Note: The Orthogonal Transformations preserve Distances and Angles. All these transformation matrices have inverses. The inverse for T is Obtained by negating dx, dy, and dz for S, by replacing sx, sy, and sz by their reciprocals; and also each of the three rotation matrices is obtained by negating the angle of rotation.
NOTE:
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 28
3 October 2013
29
COMPOSITION OF 3D TRANSFORMATIONS
To compose 3D Transformation Matrices, using an example. The objective is to transform the directed line segments P1P2 and P1P3 in following Figure from their starting position in part (a) to their ending position in part (b). Thus, point P1 is to be translated to the origin, P1P2 is to lie on the positive z axis, and P1P3 is to lie in the positive y axis half of the (y, z) plane. The lengths of the lines are to be unaffected by the transformation.
Transforming P1, P2, and P3 from their (a) Initial Position to their (b) Final Position.
3 October 2013
30
3 October 2013
31
Rotation about the y axis; The projection of P1P2, which has length D1, is rotated into the z axis. The angle shows the Positive direction of rotation about the y axis; The actual angle used is (9O ).
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 32
3 October 2013
33
3 October 2013
34
The adjacent Figure which depicts Rotation about the z axis. The protection of P1'P3, whose length is D3, is rotated by the positive angle into the y-axis, bringing the line itself into the (y, z) plane. D3 is the length of the projection.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 35
3 October 2013
36
The unit vectors Rx , Ry and Rz which are transformed into the Principal Axes.
3 October 2013
37
Fig. 2 The airplane of Fig. 1 positioned at point P and headed in direction DOF.
3 October 2013 BITS-WASE: Computer Graphics by Dr. K. Satyanarayan Reddy 38
3 October 2013
39
(5.70)
40
Figure below shows four different coordinate systems. The transformation from coordinate system 2 to 1 is Similarly
3 October 2013
41
3 October 2013
42
Consider the simple case of translating the Set of points that define the house shown in Fig. A below to the origin. This transformation is T(-x1, -y1). Labeling the two coordinate systems as in Fig. B, we see that the transformation that maps coordinate system 1 into 2 i.e. M2 1 is T(x1, y1), which is just T(-x1, -y1)-1.
3 October 2013
43
3 October 2013
44
THANK YOU
3 October 2013
45