Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Transformation matrix

From Wikipedia, the free encyclopedia
(Redirected fromReflection matrix)
Central object in linear algebra; mapping vectors to vectors

Inlinear algebra,linear transformations can be represented bymatrices. IfT{\displaystyle T} is a linear transformation mappingRn{\displaystyle \mathbb {R} ^{n}} toRm{\displaystyle \mathbb {R} ^{m}} andx{\displaystyle \mathbf {x} } is acolumn vector withn{\displaystyle n} entries, then there exists anm×n{\displaystyle m\times n} matrixA{\displaystyle A}, called thetransformation matrix ofT{\displaystyle T},[1] such that:T(x)=Ax{\displaystyle T(\mathbf {x} )=A\mathbf {x} }Note thatA{\displaystyle A} hasm{\displaystyle m} rows andn{\displaystyle n} columns, whereas the transformationT{\displaystyle T} is fromRn{\displaystyle \mathbb {R} ^{n}} toRm{\displaystyle \mathbb {R} ^{m}}. There are alternative expressions of transformation matrices involvingrow vectors that are preferred by some authors.[2][3]

Uses

[edit]

Matrices allow arbitrarylinear transformations to be displayed in a consistent format, suitable for computation.[1] This also allows transformations to becomposed easily (by multiplying their matrices).

Linear transformations are not the only ones that can be represented by matrices. Some transformations that are non-linear on an n-dimensionalEuclidean spaceRn can be represented as linear transformations on then+1-dimensional spaceRn+1. These include bothaffine transformations (such astranslation) andprojective transformations. For this reason, 4×4 transformation matrices are widely used in3D computer graphics. Thesen+1-dimensional transformation matrices are called, depending on their application,affine transformation matrices,projective transformation matrices, or more generallynon-linear transformation matrices. With respect to ann-dimensional matrix, ann+1-dimensional matrix can be described as anaugmented matrix.

In thephysical sciences, anactive transformation is one which actually changes the physical position of asystem, and makes sense even in the absence of acoordinate system whereas apassive transformation is a change in the coordinate description of the physical system (change of basis). The distinction between active and passivetransformations is important. By default, bytransformation,mathematicians usually mean active transformations, whilephysicists could mean either.

Put differently, apassive transformation refers to description of thesame object as viewed from two different coordinate frames.

Finding the matrix of a transformation

[edit]

If one has a linear transformationT(x){\displaystyle T(x)} in functional form, it is easy to determine the transformation matrixA by transforming each of the vectors of thestandard basis byT, then inserting the result into the columns of a matrix. In other words,A=[T(e1)T(e2)T(en)]{\displaystyle A={\begin{bmatrix}T(\mathbf {e} _{1})&T(\mathbf {e} _{2})&\cdots &T(\mathbf {e} _{n})\end{bmatrix}}}

For example, the functionT(x)=5x{\displaystyle T(x)=5x} is a linear transformation. Applying the above process (suppose thatn = 2 in this case) reveals that:T(x)=5x=5Ix=[5005]x{\displaystyle T(\mathbf {x} )=5\mathbf {x} =5I\mathbf {x} ={\begin{bmatrix}5&0\\0&5\end{bmatrix}}\mathbf {x} }

The matrix representation of vectors and operators depends on the chosen basis; asimilar matrix will result from an alternate basis. Nevertheless, the method to find the components remains the same.

To elaborate, vectorv{\displaystyle \mathbf {v} }can be represented in basis vectors,E=[e1e2en]{\displaystyle E={\begin{bmatrix}\mathbf {e} _{1}&\mathbf {e} _{2}&\cdots &\mathbf {e} _{n}\end{bmatrix}}} with coordinates[v]E=[v1v2vn]T{\displaystyle [\mathbf {v} ]_{E}={\begin{bmatrix}v_{1}&v_{2}&\cdots &v_{n}\end{bmatrix}}^{\mathrm {T} }}:v=v1e1+v2e2++vnen=iviei=E[v]E{\displaystyle \mathbf {v} =v_{1}\mathbf {e} _{1}+v_{2}\mathbf {e} _{2}+\cdots +v_{n}\mathbf {e} _{n}=\sum _{i}v_{i}\mathbf {e} _{i}=E[\mathbf {v} ]_{E}}

Now, express the result of the transformation matrixA uponv{\displaystyle \mathbf {v} }, in the given basis:A(v)=A(iviei)=iviA(ei)=[A(e1)A(e2)A(en)][v]E=A[v]E=[e1e2en][a1,1a1,2a1,na2,1a2,2a2,nan,1an,2an,n][v1v2vn]{\displaystyle {\begin{aligned}A(\mathbf {v} )&=A\left(\sum _{i}v_{i}\mathbf {e} _{i}\right)=\sum _{i}{v_{i}A(\mathbf {e} _{i})}\\&={\begin{bmatrix}A(\mathbf {e} _{1})&A(\mathbf {e} _{2})&\cdots &A(\mathbf {e} _{n})\end{bmatrix}}[\mathbf {v} ]_{E}=A\cdot [\mathbf {v} ]_{E}\\[3pt]&={\begin{bmatrix}\mathbf {e} _{1}&\mathbf {e} _{2}&\cdots &\mathbf {e} _{n}\end{bmatrix}}{\begin{bmatrix}a_{1,1}&a_{1,2}&\cdots &a_{1,n}\\a_{2,1}&a_{2,2}&\cdots &a_{2,n}\\\vdots &\vdots &\ddots &\vdots \\a_{n,1}&a_{n,2}&\cdots &a_{n,n}\\\end{bmatrix}}{\begin{bmatrix}v_{1}\\v_{2}\\\vdots \\v_{n}\end{bmatrix}}\end{aligned}}}

Theai,j{\displaystyle a_{i,j}} elements of matrixA are determined for a given basisE by applyingA to everyej=[00(vj=1)0]T{\displaystyle \mathbf {e} _{j}={\begin{bmatrix}0&0&\cdots &(v_{j}=1)&\cdots &0\end{bmatrix}}^{\mathrm {T} }}, and observing the response vectorAej=a1,je1+a2,je2++an,jen=iai,jei.{\displaystyle A\mathbf {e} _{j}=a_{1,j}\mathbf {e} _{1}+a_{2,j}\mathbf {e} _{2}+\cdots +a_{n,j}\mathbf {e} _{n}=\sum _{i}a_{i,j}\mathbf {e} _{i}.}

This equation defines the wanted elements,ai,j{\displaystyle a_{i,j}}, ofj-th column of the matrixA.[4]

Eigenbasis and diagonal matrix

[edit]
Main articles:Diagonal matrix andEigenvalues and eigenvectors

Yet, there is a special basis for an operator in which the components form adiagonal matrix and, thus, multiplication complexity reduces ton. Being diagonal means that all coefficientsai,j{\displaystyle a_{i,j}} exceptai,i{\displaystyle a_{i,i}} are zeros leaving only one term in the sumai,jei{\textstyle \sum a_{i,j}\mathbf {e} _{i}} above. The surviving diagonal elements,ai,i{\displaystyle a_{i,i}}, are known aseigenvalues and designated withλi{\displaystyle \lambda _{i}} in the defining equation, which reduces toAei=λiei{\displaystyle A\mathbf {e} _{i}=\lambda _{i}\mathbf {e} _{i}}. The resulting equation is known aseigenvalue equation.[5] Theeigenvectors and eigenvalues are derived from it via thecharacteristic polynomial.

Withdiagonalization, it isoften possible totranslate to and from eigenbases.

Examples in 2 dimensions

[edit]

Most commongeometric transformations that keep the origin fixed are linear, including rotation, scaling, shearing, reflection, and orthogonal projection; if an affine transformation is not a pure translation it keeps some point fixed, and that point can be chosen as origin to make the transformation linear. In two dimensions, linear transformations can be represented using a 2×2 transformation matrix.

Stretching

[edit]

A stretch in thexy-plane is a linear transformation which enlarges all distances in a particular direction by a constant factor but does not affect distances in the perpendicular direction. We only consider stretches along the x-axis and y-axis. A stretch along the x-axis has the formx' =kx;y' =y for some positive constantk. (Note that ifk > 1, then this really is a "stretch"; ifk < 1, it is technically a "compression", but we still call it a stretch. Also, ifk = 1, then the transformation is an identity, i.e. it has no effect.)

The matrix associated with a stretch by a factork along the x-axis is given by:[k001]{\displaystyle {\begin{bmatrix}k&0\\0&1\end{bmatrix}}}

Similarly, a stretch by a factork along the y-axis has the formx' =x;y' =ky, so the matrix associated with this transformation is[100k]{\displaystyle {\begin{bmatrix}1&0\\0&k\end{bmatrix}}}

Squeezing

[edit]

If the two stretches above are combined with reciprocal values, then the transformation matrix represents asqueeze mapping:[k001/k].{\displaystyle {\begin{bmatrix}k&0\\0&1/k\end{bmatrix}}.}A square with sides parallel to the axes is transformed to a rectangle that has the same area as the square. The reciprocal stretch and compression leave the area invariant.

Rotation

[edit]

Forrotation by an angle θcounterclockwise (positive direction) about the origin the functional form isx=xcosθysinθ{\displaystyle x'=x\cos \theta -y\sin \theta } andy=xsinθ+ycosθ{\displaystyle y'=x\sin \theta +y\cos \theta }. Written in matrix form, this becomes:[6][xy]=[cosθsinθsinθcosθ][xy]{\displaystyle {\begin{bmatrix}x'\\y'\end{bmatrix}}={\begin{bmatrix}\cos \theta &-\sin \theta \\\sin \theta &\cos \theta \end{bmatrix}}{\begin{bmatrix}x\\y\end{bmatrix}}}

Similarly, for a rotationclockwise (negative direction) about the origin, the functional form isx=xcosθ+ysinθ{\displaystyle x'=x\cos \theta +y\sin \theta } andy=xsinθ+ycosθ{\displaystyle y'=-x\sin \theta +y\cos \theta } the matrix form is:[xy]=[cosθsinθsinθcosθ][xy]{\displaystyle {\begin{bmatrix}x'\\y'\end{bmatrix}}={\begin{bmatrix}\cos \theta &\sin \theta \\-\sin \theta &\cos \theta \end{bmatrix}}{\begin{bmatrix}x\\y\end{bmatrix}}}

These formulae assume that thex axis points right and they axis points up.

Shearing

[edit]

Forshear mapping (visually similar to slanting), there are two possibilities.

A shear parallel to thex axis hasx=x+ky{\displaystyle x'=x+ky} andy=y{\displaystyle y'=y}. Written in matrix form, this becomes:[xy]=[1k01][xy]{\displaystyle {\begin{bmatrix}x'\\y'\end{bmatrix}}={\begin{bmatrix}1&k\\0&1\end{bmatrix}}{\begin{bmatrix}x\\y\end{bmatrix}}}

A shear parallel to they axis hasx=x{\displaystyle x'=x} andy=y+kx{\displaystyle y'=y+kx}, which has matrix form:[xy]=[10k1][xy]{\displaystyle {\begin{bmatrix}x'\\y'\end{bmatrix}}={\begin{bmatrix}1&0\\k&1\end{bmatrix}}{\begin{bmatrix}x\\y\end{bmatrix}}}

Reflection

[edit]
Main article:Householder transformation

For reflection about a line that goes through the origin, letl=(lx,ly){\displaystyle \mathbf {l} =(l_{x},l_{y})} be avector in the direction of the line. Then the transformation matrix is:A=1l2[lx2ly22lxly2lxlyly2lx2]{\displaystyle \mathbf {A} ={\frac {1}{\lVert \mathbf {l} \rVert ^{2}}}{\begin{bmatrix}l_{x}^{2}-l_{y}^{2}&2l_{x}l_{y}\\2l_{x}l_{y}&l_{y}^{2}-l_{x}^{2}\end{bmatrix}}}

Orthogonal projection

[edit]
Further information:Orthogonal projection

To project a vector orthogonally onto a line that goes through the origin, letu=(ux,uy){\displaystyle \mathbf {u} =(u_{x},u_{y})} be avector in the direction of the line. Then the transformation matrix is:A=1u2[ux2uxuyuxuyuy2]{\displaystyle \mathbf {A} ={\frac {1}{\lVert \mathbf {u} \rVert ^{2}}}{\begin{bmatrix}u_{x}^{2}&u_{x}u_{y}\\u_{x}u_{y}&u_{y}^{2}\end{bmatrix}}}

As with reflections, the orthogonal projection onto a line that does not pass through the origin is an affine, not linear, transformation.

Parallel projections are also linear transformations and can be represented simply by a matrix. However, perspective projections are not, and to represent these with a matrix,homogeneous coordinates can be used.

Examples in 3D computer graphics

[edit]

Rotation

[edit]

Thematrix to rotate an angleθ about any axis defined byunit vector (x,y,z) is[7][xx(1cosθ)+cosθyx(1cosθ)zsinθzx(1cosθ)+ysinθxy(1cosθ)+zsinθyy(1cosθ)+cosθzy(1cosθ)xsinθxz(1cosθ)ysinθyz(1cosθ)+xsinθzz(1cosθ)+cosθ].{\displaystyle {\begin{bmatrix}xx(1-\cos \theta )+\cos \theta &yx(1-\cos \theta )-z\sin \theta &zx(1-\cos \theta )+y\sin \theta \\xy(1-\cos \theta )+z\sin \theta &yy(1-\cos \theta )+\cos \theta &zy(1-\cos \theta )-x\sin \theta \\xz(1-\cos \theta )-y\sin \theta &yz(1-\cos \theta )+x\sin \theta &zz(1-\cos \theta )+\cos \theta \end{bmatrix}}.}

Reflection

[edit]
Main article:Householder transformation

To reflect a point through a planeax+by+cz=0{\displaystyle ax+by+cz=0} (which goes through the origin), one can useA=I2NNT{\displaystyle \mathbf {A} =\mathbf {I} -2\mathbf {NN} ^{\mathrm {T} }}, whereI{\displaystyle \mathbf {I} } is the 3×3 identity matrix andN{\displaystyle \mathbf {N} } is the three-dimensionalunit vector for the vector normal of the plane. If theL2 norm ofa{\displaystyle a},b{\displaystyle b}, andc{\displaystyle c} is unity, the transformation matrix can be expressed as:A=[12a22ab2ac2ab12b22bc2ac2bc12c2]{\displaystyle \mathbf {A} ={\begin{bmatrix}1-2a^{2}&-2ab&-2ac\\-2ab&1-2b^{2}&-2bc\\-2ac&-2bc&1-2c^{2}\end{bmatrix}}}

Note that these are particular cases of aHouseholder reflection in two and three dimensions. A reflection about a line or plane that does not go through the origin is not a linear transformation — it is anaffine transformation — as a 4×4 affine transformation matrix, it can be expressed as follows (assuming the normal is a unit vector):[xyz1]=[12a22ab2ac2ad2ab12b22bc2bd2ac2bc12c22cd0001][xyz1]{\displaystyle {\begin{bmatrix}x'\\y'\\z'\\1\end{bmatrix}}={\begin{bmatrix}1-2a^{2}&-2ab&-2ac&-2ad\\-2ab&1-2b^{2}&-2bc&-2bd\\-2ac&-2bc&1-2c^{2}&-2cd\\0&0&0&1\end{bmatrix}}{\begin{bmatrix}x\\y\\z\\1\end{bmatrix}}}whered=pN{\displaystyle d=-\mathbf {p} \cdot \mathbf {N} } for some pointp{\displaystyle \mathbf {p} } on the plane, or equivalently,ax+by+cz+d=0{\displaystyle ax+by+cz+d=0}.

If the 4th component of the vector is 0 instead of 1, then only the vector's direction is reflected and its magnitude remains unchanged, as if it were mirrored through a parallel plane that passes through the origin. This is a useful property as it allows the transformation of both positional vectors and normal vectors with the same matrix. Seehomogeneous coordinates andaffine transformations below for further explanation.

Composing and inverting transformations

[edit]

One of the main motivations for using matrices to represent linear transformations is that transformations can then be easilycomposed and inverted.

Composition is accomplished bymatrix multiplication.Row and column vectors are operated upon by matrices, rows on the left and columns on the right. Since text reads from left to right, column vectors are preferred when transformation matrices are composed:

IfA andB are the matrices of two linear transformations, then the effect of first applyingA and thenB to a column vectorx{\displaystyle \mathbf {x} } is given by:B(Ax)=(BA)x.{\displaystyle \mathbf {B} (\mathbf {A} \mathbf {x} )=(\mathbf {BA} )\mathbf {x} .}

In other words, the matrix of the combined transformationA followed byB is simply the product of the individual matrices.

WhenA is aninvertible matrix there is a matrixA−1 that represents a transformation that "undoes"A since its composition withA is theidentity matrix. In some practical applications, inversion can be computed using general inversion algorithms or by performing inverse operations (that have obvious geometric interpretation, like rotating in opposite direction) and then composing them in reverse order. Reflection matrices are a special case becausethey are their own inverses and don't need to be separately calculated.

Other kinds of transformations

[edit]

Affine transformations

[edit]
Effect of applying various 2D affine transformation matrices on a unit square. Note that the reflection matrices are special cases of the scaling matrix.
Affine transformations on the 2D plane can be performed in three dimensions. Translation is done by shearing parallel to the xy plane, and rotation is performed around the z axis.

To representaffine transformations with matrices, we can usehomogeneous coordinates. This means representing a 2-vector (x,y) as a 3-vector (x,y, 1), and similarly for higher dimensions. Using this system, translation can be expressed with matrix multiplication. The functional formx=x+tx;y=y+ty{\displaystyle x'=x+t_{x};y'=y+t_{y}} becomes:[xy1]=[10tx01ty001][xy1].{\displaystyle {\begin{bmatrix}x'\\y'\\1\end{bmatrix}}={\begin{bmatrix}1&0&t_{x}\\0&1&t_{y}\\0&0&1\end{bmatrix}}{\begin{bmatrix}x\\y\\1\end{bmatrix}}.}

All ordinary linear transformations are included in the set of affine transformations, and can be described as a simplified form of affine transformations. Therefore, any linear transformation can also be represented by a general transformation matrix. The latter is obtained by expanding the corresponding linear transformation matrix by one row and column, filling the extra space with zeros except for the lower-right corner, which must be set to 1. For example,thecounter-clockwiserotation matrix from above becomes:[cosθsinθ0sinθcosθ0001]{\displaystyle {\begin{bmatrix}\cos \theta &-\sin \theta &0\\\sin \theta &\cos \theta &0\\0&0&1\end{bmatrix}}}

Using transformation matrices containing homogeneous coordinates, translations become linear, and thus can be seamlessly intermixed with all other types of transformations. The reason is that the real plane is mapped to thew = 1 plane in real projective space, and so translation in realEuclidean space can be represented as a shear in real projective space. Although a translation is a non-linear transformation in a 2-D or 3-D Euclidean space described by Cartesian coordinates (i.e. it can't be combined with other transformations while preservingcommutativity and other properties), itbecomes, in a 3-D or 4-D projective space described by homogeneous coordinates, a simple linear transformation (ashear).

More affine transformations can be obtained bycomposition of two or more affine transformations. For example, given a translationT' with vector(tx,ty),{\displaystyle (t'_{x},t'_{y}),} a rotationR by an angle θcounter-clockwise, a scalingS with factors(sx,sy){\displaystyle (s_{x},s_{y})} and a translationT of vector(tx,ty),{\displaystyle (t_{x},t_{y}),} the resultM ofT'RST is:[8][sxcosθsysinθtxsxcosθtysysinθ+txsxsinθsycosθtxsxsinθ+tysycosθ+ty001]{\displaystyle {\begin{bmatrix}s_{x}\cos \theta &-s_{y}\sin \theta &t_{x}s_{x}\cos \theta -t_{y}s_{y}\sin \theta +t'_{x}\\s_{x}\sin \theta &s_{y}\cos \theta &t_{x}s_{x}\sin \theta +t_{y}s_{y}\cos \theta +t'_{y}\\0&0&1\end{bmatrix}}}

When using affine transformations, the homogeneous component of a coordinate vector (normally calledw) will never be altered. One can therefore safely assume that it is always 1 and ignore it. However, this is not true when using perspective projections.

Perspective projection

[edit]
Main article:Perspective projection
Further information:Pinhole camera model
Comparison of the effects of applying 2D affine and perspective transformation matrices on a unit square.

Another type of transformation, of importance in3D computer graphics, is theperspective projection. Whereas parallel projections are used to project points onto the image plane along parallel lines, the perspective projection projects points onto the image plane along lines that emanate from a single point, called the center of projection. This means that an object has a smaller projection when it is far away from the center of projection and a larger projection when it is closer (see alsoreciprocal function).

The simplest perspective projection uses the origin as the center of projection, and the plane atz=1{\displaystyle z=1} as the image plane. The functional form of this transformation is thenx=x/z{\displaystyle x'=x/z};y=y/z{\displaystyle y'=y/z}. We can express this inhomogeneous coordinates as:[xcyczcwc]=[1000010000100010][xyz1]=[xyzz]{\displaystyle {\begin{bmatrix}x_{c}\\y_{c}\\z_{c}\\w_{c}\end{bmatrix}}={\begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&1&0\end{bmatrix}}{\begin{bmatrix}x\\y\\z\\1\end{bmatrix}}={\begin{bmatrix}x\\y\\z\\z\end{bmatrix}}}

After carrying out thematrix multiplication, the homogeneous componentwc{\displaystyle w_{c}} will be equal to the value ofz{\displaystyle z} and the other three will not change. Therefore, to map back into the real plane we must perform thehomogeneous divide orperspective divide by dividing each component bywc{\displaystyle w_{c}}:[xyz1]=1wc[xcyczcwc]=[x/zy/z11]{\displaystyle {\begin{bmatrix}x'\\y'\\z'\\1\end{bmatrix}}={\frac {1}{w_{c}}}{\begin{bmatrix}x_{c}\\y_{c}\\z_{c}\\w_{c}\end{bmatrix}}={\begin{bmatrix}x/z\\y/z\\1\\1\end{bmatrix}}}

More complicated perspective projections can be composed by combining this one with rotations, scales, translations, and shears to move the image plane and center of projection wherever they are desired.

See also

[edit]

References

[edit]
  1. ^abGentle, James E. (2007)."Matrix Transformations and Factorizations".Matrix Algebra: Theory, Computations, and Applications in Statistics. Springer.ISBN 9780387708737.
  2. ^Rafael Artzy (1965)Linear Geometry
  3. ^J. W. P. Hirschfeld (1979)Projective Geometry of Finite Fields,Clarendon Press
  4. ^Nearing, James (2010)."Chapter 7.3 Examples of Operators"(PDF).Mathematical Tools for Physics.ISBN 978-0486482125. RetrievedJanuary 1, 2012.
  5. ^Nearing, James (2010)."Chapter 7.9: Eigenvalues and Eigenvectors"(PDF).Mathematical Tools for Physics.ISBN 978-0486482125. RetrievedJanuary 1, 2012.
  6. ^"Lecture Notes"(PDF).ocw.mit.edu. Retrieved2024-07-28.
  7. ^Szymanski, John E. (1989).Basic Mathematics for Electronic Engineers:Models and Applications. Taylor & Francis. p. 154.ISBN 0278000681.
  8. ^Cédric Jules (February 25, 2015)."2D transformation matrices baking".

External links

[edit]
Basic concepts
Three dimensional Euclidean space
Matrices
Bilinear
Multilinear algebra
Vector space constructions
Numerical
Matrix classes
Explicitly constrained entries
Constant
Conditions oneigenvalues or eigenvectors
Satisfying conditions onproducts orinverses
With specific applications
Used instatistics
Used ingraph theory
Used in science and engineering
Related terms
Retrieved from "https://en.wikipedia.org/w/index.php?title=Transformation_matrix&oldid=1275425866"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp