[ Pobierz całość w formacie PDF ]
.Matrix multiplication is associative.This means that the product of three or more matrices is equal,no matter which two matrices are multiplied first.By virtue of this property, you are now able toexpress a complex transformation by combining several basic transformations.This process isgenerally known as matrix concatenation.For example, in Figure 3-7 the image of the constellation Ursa Minor is rotated clockwise 60degrees about the origin.But it is possible to perform this transformation using any arbitrary pointin the coordinate system as a pivot point.For instance, to rotate a polygon about any arbitrarypoint pa, the following sequence of transformations is executed:1.Translate the polygon so that point pa is at the coordinate origin.2.Rotate the polygon.3.Translate the polygon so that point pa returns to its original position.In matrix form the sequence of transformations can be expressed as the following product:Performing the indicated multiplication yields the matrix for a counterclockwise rotation, throughangle r, about point pa, with coordinates (Tx,Ty).Although matrix multiplication is associative, it is not commutative.Therefore, the order in whichthe operations are performed can affect the results.A fact that confirms the validity of the matrixrepresentation of graphics transformations is that, graphically, the results of performingtransformations in different sequences can also yield different results.For example, the imageresulting from a certain rotation, followed by a translation transformation, may not be identical tothe one resulting from performing the translation first and then the rotation.Figure 3-8 shows a case in which the order of the transformations determines a difference in thefinal object. Figure 3-8: Order of transformations 3D TransformationsTwo-dimensional objects are defined by their coordinate pairs in 2D space.By extending thismodel you can represent a three-dimensional object by means of a set of coordinate triples in 3Dspace.Adding a z-axis that encodes the depth component of each image point produces a three-dimensional coordinate system.The coordinates that define each image point in 3D space are atriplet of x, y, and z values.Because the three-dimensional model is an extension of the two-dimensional one, you can apply geometrical transformations in a similar manner as you did withtwo-dimensional objects.Figure 3-9 shows a rectangular solid in 3D space.Figure 3-9: 3D representation of a rectangular solidThe solid in Figure 3-9 is defined by means of the coordinate triplets of each of its eight points,which are represented by the labeled black dots.In tabular form the coordinates of each point aredefined as follows:x y zp1 0 0 2p2 4 0 2p3 4 2 2p4 0 2 2p5 0 0 0p6 4 0 0 p7 4 2 0p8 0 2 0Point p5, which is at the origin, has values of zero for all three coordinates.Point p1 is located 2units along the z-axis, therefore its coordinates are x = 0, y = 0, z = 2.Notice that if you disregardthe z-axis coordinates, then the two planes formed by points p1, p2, p3, and p4 and points p5, p6,p7, and p8 would have identical values for the x- and y-axis.This is consistent with the notion of arectangular solid as a solid formed by two rectangles residing in 3D space.3D translationIn 2D representations, a translation transformation is performed by adding a constant value toeach coordinate point that defines the object.This continues to be true when the point'scoordinates are contained in three planes.As in the case of a 2D object, the transformationconstant is applied to each plane to determine the new position of each image point.Figure 3-10shows the translation of a cube defined in 3D space by adding 2 units to the x-axis coordinates, 6units to the y-axis, and -2 units to the z-axis.Figure 3-10: Translation transformation of a cubeIf the coordinate points of the eight vertices of the cube in Figure 3-10 were represented in a 3-by-8 matrix (designated as matrix A) and the transformation constants in a second 8-by-3 matrix(designated as matrix B), then you could perform the translation transformation by means of matrixaddition and store the transformed coordinates in a results matrix (designated as matrix C).Thematrix operation A + B = C operation would be expressed as follows: Here again, you can express the geometric transformation in terms of homogeneous coordinates.The translation transformation matrix for 3D space would be as follows:The parameters Tx, Ty, and Tz represent the translation constants for each axis.As in the case ofa 2D transformation, the new coordinates are determined by adding the corresponding constant toeach coordinate point of the figure to be translated.If x', y', and z' are the translated coordinates ofthe point at x, y, and z, the translation transformation takes place as follows:x' = x + Txy' = y + Tyz' = z + TzAs in the case of 2D geometrical transformations, the transformed results are obtained by matrixmultiplication using the matrix with the object's coordinate points as the first product matrix, andthe homogenous translation transformation matrix as the second one.3D scaling A scaling transformation consists of applying a multiplying factor to each coordinate point thatdefines the object.A scaling transformation in 3D space is consistent with the scaling in 2D space.The only difference is that in 3D space the scaling factor is applied to each of three planes, insteadof the two planes of 2D space.Here again the scaling factors can be different for each plane.If thisis the case, the resulting transformation is described as an asymmetrical scaling.When the scalingfactor is the same for all three axes, the scaling is described as symmetrical or uniform.Figure 3-11 shows the uniform scaling of a cube by applying a scaling factor of 2 to the coordinates of eachfigure vertex.Figure 3-11: Scaling transformation of a cubeThe homogeneous matrix for a 3D scaling transformation is as follows:The parameters Sx, Sy, and Sz represent the scaling factors for each axis.As in the case of a 2Dtransformation, the new coordinates are determined by multiplying the corresponding scaling factorwith each coordinate point of the figure to be scaled [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • funlifepok.htw.pl
  •