一個使用仿射變換所製造有自相似性的碎形
仿射變換(Affine transformation),又稱仿射映射,是指在幾何中,對一個向量空間進行一次線性變換並接上一個平移,變換為另一個向量空間。
一個對向量
平移
,與旋轉縮放
的仿射映射為
![{\displaystyle {\vec {y}}=A{\vec {x}}+{\vec {b}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/34163be2c581b857c2da8867fd69563e74755806)
上式在齊次坐標上,等價於下面的式子
![{\displaystyle {\begin{bmatrix}{\vec {y}}\\1\end{bmatrix}}={\begin{bmatrix}A&{\vec {b}}\ \\0,\ldots ,0&1\end{bmatrix}}{\begin{bmatrix}{\vec {x}}\\1\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/fa6f3cc92896da3b7eca116ecebabba7be676cb2)
在分形的研究裡,收縮平移仿射映射可以製作具有自相似性的分形。
數學定義[編輯]
一個於兩仿射空間間定義的仿射變換
是一個點集映射,線性地作用於向量(即空間中的點之間的向量)。形式化表述是,
決定一線性變換
,使得對於任意
中的點對
,有:
![{\displaystyle {\overrightarrow {f(P)~f(Q)}}=\varphi \left({\overrightarrow {PQ}}\right)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/cda00baa9ef78a0f35c8f76b3673538e1cc3b50f)
或記
![{\displaystyle f(Q)-f(P)=\varphi (Q-P).}](https://wikimedia.org/api/rest_v1/media/math/render/svg/fbdfa0975eb953d3edad27673dcdf93df2684926)
我們可以以其他一些方式解釋這一定義,以下進行說明:
若於
中選定一原點
,記其於
中的像為
,那麼就意味着,對於任意向量
,有
![{\displaystyle f\colon (O+{\boldsymbol {x}})\mapsto (B+\varphi ({\boldsymbol {x}})).}](https://wikimedia.org/api/rest_v1/media/math/render/svg/18423d5f7794443ac6dee771672920c36498289b)
而若於
中選定一原點
,則其可分解為一將
映到
的仿射變換
,換言之,遵從向量
之變換,
以上可以直觀地總結為,仿射變換包含一個線性映射與一個變換。
等價定義[編輯]
給定相同域上的兩仿射空間
和
,稱一映射
為仿射變換,當且僅當對於任意
上滿足
的權重點簇
有[1]
換言之,
保持了原相的質心。
如上所示,仿射變換為兩函數的複合:平移及線性映射。普通向量代數用矩陣乘法呈現線性映射, 用向量加法表示平移。正式言之,於有限維度之例中,假如該線性映射被表示為一矩陣「A」,平移被表示為向量
,一仿射映射
可被表示為
![{\displaystyle {\vec {y}}=f({\vec {x}})=A{\vec {x}}+{\vec {b}}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/02dfa41f69036147fe37ebb7646cfab97b4208dd)
增廣矩陣[編輯]
二維平面上的仿射變換可呈現於三維空間中。平移即為沿著z軸的錯切,旋轉則以z軸為軸心
使用一 增廣矩陣 與一增廣向量, 用一矩陣乘法同時表示平移與線性映射是有可能的。此技術需要所有向量在其末端擴長 「1」且所有矩陣都於底部添加一排零,右邊擴長一列轉換向量,及右下角添加一個 「1」。
![{\displaystyle {\begin{bmatrix}{\vec {y}}\\1\end{bmatrix}}=\left[{\begin{array}{ccc|c}\,&A&&{\vec {b}}\ \\0&\ldots &0&1\end{array}}\right]{\begin{bmatrix}{\vec {x}}\\1\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4b3f8dfb50a5d0500891ce899036d73cfd362042)
等價於
![{\displaystyle {\vec {y}}=A{\vec {x}}+{\vec {b}}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f4aabb24a65adc3f6c39f02783f41dfed7dd8221)
以上所言之擴長矩陣被稱為 「仿射變換矩陣」,又或稱為 「投射變換矩陣」 (其可應用於 投影轉換)。
此表示法以 Kn之半直積 與 GL(n, k)展示了 所有可逆 仿射變換的集合。 此為一個於眾函數集結下進行的一個 群, 被稱為 仿射群
普通矩陣向量乘法總將原點映射至原點,因此無法呈現平移(原點必須映射至其他點)。藉由於所有向量上擴增一座標 「1」,我們將原空間映至更高維空間的一個子集合以進行變換。在該空間中,原本之空間佔有了擴長座標一的1的子集合。 因此原空間的原點可在(0,0, ... 0, 1)。原空間的平移可藉由更高維度空間的線性轉換來達成(即為錯切變換)。在高維度中的座標即為 齊次座標的一例。 假如原空間為歐幾里德, 則更高維空間為實射影空間。
使用齊次座標的優點為,藉由相對應矩陣之乘積,可將任意數目的仿射變換結合為一。此性質被大量運用於 計算機圖形, 計算機視覺 與 機器人學。
仿射變換保留了:
- 點之間的共線性:在同一條直線上的三個或更多的點(稱為共線點)在變換後依然在同一條直線上(共線);
- 直線的平行性:兩條或以上的平行直線,在變換後依然平行;
- 集合的凸性:凸集合變換後依然是凸集合。並且,最初的極值點被映射到變換後的極值點集[2];
- 平行線段的長度的比例:兩條由點
定義的平行線段,
與
的長度的比例等於
與
的長度的比例;
- 不同質量的點組成集合的質心。
仿射變換為可逆的當且僅當
為可逆的。用矩陣表示,其逆元為:
可逆仿射變換組成仿射群,其中包含具n階的一般線性群為子群,且自身亦為一
階的一般線性群之子群。
當A為常數乘以正交矩陣時,此子集合構成一子群,稱之為相似變換。舉例而言,假如仿射變換於一平面上且假如
之行列式為
或
,那麼該變換即為等面積變換。此類變換組成被稱為等仿射群的子群。一同時為等面積變換與相似變換的變換,即為一平面上保持歐幾里德距離不變的保距映射。
這些群都有一保留了原定向的子群,也就是其對應之
的行列式大於零。最後一個例子,即三維空間中剛體的運動組成的群(旋轉和平移),剛體的運動在機器人學中尤為常用[3]。
如果有一固定點,我們可以將其當成原點,則仿射變換被縮還到一線性變換。這使得變換更易於分類與理解。舉例而言,將一變換敘述為特定軸的旋轉,相較於將其形容為平移與旋轉的結合,更能提供變換行為清楚的解釋。只是,這取決於應用與內容。
實數之仿射變換[編輯]
函數f : R → R, f(x) = mx + c ,其中m與c為常數,此即為一般之仿射變換。
有限體的仿射變換[編輯]
以下等式表示了有限體(28)中的仿射變換:
![{\displaystyle \{\,a'\,\}=M\{\,a\,\}\oplus \{\,v\,\},}](https://wikimedia.org/api/rest_v1/media/math/render/svg/0f7ef3e487fa94b48cad3c66559790c34060c50b)
此處[M]為矩陣 且 {v} 為向量 :
: :
|
舉例來講,將以大端序二進位表示的元素{a} = y7 + y6 + y3 + y = {11001010}轉換成大端序十六進位,計算如下:
![{\displaystyle a_{0}'=a_{0}\oplus a_{4}\oplus a_{5}\oplus a_{6}\oplus a_{7}\oplus 1=0\oplus 0\oplus 0\oplus 1\oplus 1\oplus 1=1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/19b9e1fdb42b1f5713b4615a6e355103b9c94ef6)
![{\displaystyle a_{1}'=a_{0}\oplus a_{1}\oplus a_{5}\oplus a_{6}\oplus a_{7}\oplus 1=0\oplus 1\oplus 0\oplus 1\oplus 1\oplus 1=0}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4986f8a1270c2864a180ce850a5b86b96038619a)
![{\displaystyle a_{2}'=a_{0}\oplus a_{1}\oplus a_{2}\oplus a_{6}\oplus a_{7}\oplus 0=0\oplus 1\oplus 0\oplus 1\oplus 1\oplus 0=1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c053a95ec45711b465f28ec20486ae4cffcb02e4)
![{\displaystyle a_{3}'=a_{0}\oplus a_{1}\oplus a_{2}\oplus a_{3}\oplus a_{7}\oplus 0=0\oplus 1\oplus 0\oplus 1\oplus 1\oplus 0=1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5b0b1412ac479a9bc6a4630649a8f4a5e9ab1f48)
![{\displaystyle a_{4}'=a_{0}\oplus a_{1}\oplus a_{2}\oplus a_{3}\oplus a_{4}\oplus 0=0\oplus 1\oplus 0\oplus 1\oplus 0\oplus 0=0}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ee70f09316a70b9a0e354bad94ccadc154fe8a9c)
![{\displaystyle a_{5}'=a_{1}\oplus a_{2}\oplus a_{3}\oplus a_{4}\oplus a_{5}\oplus 1=1\oplus 0\oplus 1\oplus 0\oplus 0\oplus 1=1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c6ff5b53c7c4c642b37701e9deb8132b0c753609)
![{\displaystyle a_{6}'=a_{2}\oplus a_{3}\oplus a_{4}\oplus a_{5}\oplus a_{6}\oplus 1=0\oplus 1\oplus 0\oplus 0\oplus 1\oplus 1=1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9afac1408c64ef6bd9601cb50930252f4335af49)
![{\displaystyle a_{7}'=a_{3}\oplus a_{4}\oplus a_{5}\oplus a_{6}\oplus a_{7}\oplus 0=1\oplus 0\oplus 0\oplus 1\oplus 1\oplus 0=1.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/81d001e2093744d7efbf4d9dbd61779fce68d389)
於是, {a′} = y7 + y6 + y5 + y3 + y2 + 1 = {11101101} = {ED}。
平面幾何之仿射變換[編輯]
一個實數平面上的簡單仿射變換
在 ℝ2,左方所示之變換即為以下映射:
![{\displaystyle {\begin{bmatrix}x\\y\end{bmatrix}}\mapsto {\begin{bmatrix}0&1\\2&1\end{bmatrix}}{\begin{bmatrix}x\\y\end{bmatrix}}+{\begin{bmatrix}-100\\-100\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b3ce2bf90beae1d5b7cd808ff9e4fadae8e72136)
將原紅色三角形之三個頂點作變換後給出了新藍色三角形的三個頂點。事實上,所有三角形皆可由仿射變換來達成,所有平行四邊形也可以,但一般四邊形不行。
- ^ Schneider, Philip K.; Eberly, David H. Geometric Tools for Computer Graphics. Morgan Kaufmann. 2003: 98 [2024-06-18]. ISBN 978-1-55860-594-7. (原始內容存檔於2023-10-25).
- ^ Reinhard Schultz. Affine transformations and convexity (PDF). [27 February 2017]. (原始內容存檔 (PDF)於2020-11-25).
- ^ Robotic Systems Lab, ETH Zurich. Robot Dynamics Lecture Notes (PDF). [2020-04-25]. (原始內容存檔 (PDF)於2020-11-12).