矩阵转换表示(翻译).docx_第1页
矩阵转换表示(翻译).docx_第2页
矩阵转换表示(翻译).docx_第3页
矩阵转换表示(翻译).docx_第4页
矩阵转换表示(翻译).docx_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

This article copy form MSDN 2001. mk:MSITStore:C:Program%20FilesMicrosoft%20Visual%20StudioMSDN2001OCT1033gdicpp.chm:/hh/gdicpp/cpp_aboutgdip05_00c4.htmPlatformSDK:GDI+ Translate By guozhengkun转换矩阵表示一个 mn matrix is a set of numbers arranged in m rows and n columns. The following illustration shows several matrices.一个mn 矩阵是m行n列的一组数字集合。下图列出了几种矩阵。You can add two matrices of the same size by adding individual elements. The following illustration shows two examples of matrix addition.你可以通过矩阵每个元素相加实现两个大小相同的矩阵的加法运算An mn matrix can be multiplied by an np matrix, and the result is an mp matrix. The number of columns in the first matrix must be the same as the number of rows in the second matrix. For example, a 42 matrix can be multiplied by a 23 matrix to produce a 43 matrix.一个 mn 矩阵乘以 np 矩阵, 结果是mp 矩阵. 第一个矩阵的列数必须和第二个矩阵的行数相同才能相乘。举例,一个 42 矩阵可以通过一个 43 矩阵乘以 23 矩阵得到。Points in the plane and rows and columns of a matrix can be thought of as vectors. For example, (2, 5) is a vector with two components, and (3, 7, 1) is a vector with three components. The dot product of two vectors is defined as follows:平面上的点集和矩阵的行列可以看作向量的集合。例如,(2, 5) 是一个包含两个分量的向量,and (3, 7, 1) 是一个包含三个分量的向量。两个向量的点积定义如下:(a, b) (c, d) = ac + bd(a, b, c) (d, e, f) = ad + be + cfFor example, the dot product of (2, 3) and (5, 4) is (2)(5) + (3)(4) = 22. The dot product of (2, 5, 1) and (4, 3, 1) is (2)(4) + (5)(3) + (1)(1) = 24. Note that the dot product of two vectors is a number, not another vector. Also note that you can calculate the dot product only if the two vectors have the same number of components.例如, (2, 3) 和 (5, 4) 的点积等于 (2)*(5) + (3)*(4) = 22。 (2, 5, 1) 和 (4, 3, 1) 等于 (2)(4) + (5)(3) + (1)(1) = 24。注意两个向量的点积是一个数值,不是另一个向量。另外,注意只有分量个数相同的向量才能计算点积。Let A(i, j) be the entry in matrix A in the ith row and the jth column. For example A(3, 2) is the entry in matrix A in the 3rd row and the 2nd column. Suppose A, B, and C are matrices, and AB = C. The entries of C are calculated as follows:假定A(i, j) 是矩阵A第i行第j列的项。例如,A(3, 2)是矩阵A的第3行第2列的项。假设A, B 和 C都是矩阵,且AB相乘等于C。C的任一项计算方法如下:C(i, j) = (row i of A) (column j of B)The following illustration shows several examples of matrix multiplication.下面插图是了几个矩阵相乘的例子If you think of a point in the plane as a 12 matrix, you can transform that point by multiplying it by a 22 matrix. The following illustration shows several transformations applied to the point (2, 1).如果把平面上一点看作是1行2列的矩阵,你可以通过给该矩阵乘以2行2列矩阵对该点进行坐标变换。下面是点(2, 1)的几个转换应用。All the transformations shown in the previous figure are linear transformations. Certain other transformations, such as translation, are not linear, and cannot be expressed as multiplication by a 22 matrix. Suppose you want to start with the point (2, 1), rotate it 90 degrees, translate it 3 units in the x direction, and translate it 4 units in the y direction. You can accomplish this by performing a matrix multiplication followed by a matrix addition.上面图形显示的所有变换都是线性变换。另外一些变换,比如平移,就不是线性的,且不能通过乘以2行2列的矩阵来表示。假设你想先把点(2, 1)旋转90度,然后在X方向平移3个单位,Y方向平移4个单位。你可以通过一个矩阵乘法在跟上一个矩阵加法实现。A linear transformation (multiplication by a 22 matrix) followed by a translation (addition of a 12 matrix) is called an affine transformation. An alternative to storing an affine transformation in a pair of matrices (one for the linear part and one for the translation) is to store the entire transformation in a 33 matrix. To make this work, a point in the plane must be stored in a 13 matrix with a dummy 3rd coordinate. The usual technique is to make all 3rd coordinates equal to 1. For example, the point (2, 1) is represented by the matrix 2 1 1. The following illustration shows an affine transformation (rotate 90 degrees; translate 3 units in the x direction, 4 units in the y direction) expressed as multiplication by a single 33 matrix.一个线性变换(乘以2行2列矩阵)跟一个平移变换(加1行2列矩阵)称为一个仿射变换。可选的,用一对矩阵(一个线性变换和一个平移变换)存储仿射变换是把完整的变换存储在一个3行3列的矩阵中。为了完成这个工作,平面上一点必须存储为带一个第3维虚拟坐标的1行3列矩阵。通用的做法是使第3维坐标等于1。例如,点(2, 1) 被表示为矩阵 2 1 1。下图是把一个仿射变换 (旋转90度; X方向平移3个单位, Y方向平移4个单位) 表示为乘以单个的3行3列矩阵。In the previous example, the point (2, 1) is mapped to the point (2, 6). Note that the third column of the 33 matrix contains the numbers 0, 0, 1. This will always be the case for the 33 matrix of an affine transformation. The important numbers are the six numbers in columns 1 and 2. The upper-left 22 portion of the matrix represents the linear part of the transformation, and the first two entries in the 3rd row represent the translation.在上面的例子中,点(2, 1) 被映射为点 (2, 6)。注意3行3列矩阵的第三列包含数字0, 0, 1,对于一个3行3列仿射变换矩阵总是这样的。重要的数字是第一列和第二列的6个数字。矩阵左上22部分代表线性变换,然后第三行的两项表示平移变换。In GDI+ you can store an affine transformation in a Matrix object. Because the third column of a matrix that represents an affine transformation is always (0, 0, 1), you specify only the six numbers in the first two columns when you construct a Matrix object. The statement Matrix myMatrix(0.0f, 1.0f, -1.0f, 0.0f, 3.0f, 4.0f); constructs the matrix shown in the previous figure.在GDI+中,你可以使用矩阵对象存储仿射变换。因为表示仿射变换的矩阵第三列总是(0, 0, 1),你只需要指定第一列和第二列的6个数字来构造矩阵对象。语句Matrix myMatrix(0.0f, 1.0f, -1.0f, 0.0f, 3.0f, 4.0f); 构造的矩阵显示在上图中。Composite Transformations复合变换A composite transformation is a sequence of transformations, one followed by the other. Consider the matrices and transformations in the following list:一个复合变换是一组变换,一个接一个。考虑下面列出的矩阵和变换:Matrix ARotate 90 degreesMatrix BScale by a factor of 2 in the x directionMatrix CTranslate 3 units in the y directionIf we start with the point (2, 1) represented by the matrix 2 1 1 and multiply by A, then B, then C, the point (2,1) will undergo the three transformations in the order listed.如果我们把一个点(2, 1) 表示成矩阵 2 1 1 然后乘A,再乘B,在乘C,那么点 (2, 1) 经历命令表包含的三次变换。2 1 1ABC = 2 5 1Rather than store the three parts of the composite transformation in three separate matrices, you can multiply A, B, and C together to get a single 33 matrix that stores the entire composite transformation. Suppose ABC = D. Then a point multiplied by D gives the same result as a point multiplied by A, then B, then C.与其把复合变换的三部分存储在三个独立的矩阵中,不如用A乘B再乘C得到单个的3行3列矩阵存储复合变换。假设ABC = D. 那么点乘以D 得到与点乘A乘B再乘C相同的结果。2 1 1D = 2 5 1The following illustration shows the matrices A, B, C, and D.The fact that the matrix of a composite transformation can be formed by multiplying the individual transformation matrices means that any sequence of affine transformations can be stored in a single Matrix object.事实上,复合变换的矩阵可以表示成若干个单独变换矩阵相乘,就是说一个仿射变换序列可以存储在一个矩阵对象中。CautionThe order of a composite transformation is important. In general, rotate, then scale, then translate is not the same as scale, then rotate, then translate. Similarly, the order of matrix multiplication is important. In general, ABC is n

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论