2011年11月15日 星期二

用矩陣旋轉圓錐曲線

以下是對於原點旋轉
令\[
A=\begin{bmatrix}x\\y\\1\end{bmatrix},
M=\begin{bmatrix}a&\frac{b}2&\frac{d}2\\\frac{b}2&c&\frac{e}2\\\frac{d}2&\frac{e}2&f\end{bmatrix}
\]圓錐曲線的一般式是\[
\Gamma:ax^2+bxy+cy^2+dx+ey+f=0
\]可改寫成\[
\Gamma:A^TMA=0
\]令逆時針旋轉$\theta$角的旋轉矩陣為\[
R_{\theta}=\begin{bmatrix}\cos{\theta}&-\sin{\theta}&0\\\sin{\theta}&\cos{\theta}&0\\0&0&1\end{bmatrix}
\]則旋轉過$\theta$角之後的圓錐曲線為\[
\Gamma':A^TR_{\theta}^TMR_{\theta}A=0
\]
##ReadMore##
以上我還沒證明,不過我的想法是
一般二維的坐標旋轉可以寫成這樣\[
\begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}\cos{\theta}&-\sin{\theta}\\\sin{\theta}&\cos{\theta}\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}
\]改寫成齊次坐標的形式就變成這樣\[
\begin{bmatrix}x'\\y'\\1\end{bmatrix}=\begin{bmatrix}\cos{\theta}&-\sin{\theta}&0\\\sin{\theta}&\cos{\theta}&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix}
\]兩邊轉置得\[
\begin{bmatrix}x'&y'&1\end{bmatrix}=\begin{bmatrix}x&y&1\end{bmatrix}\begin{bmatrix}\cos{\theta}&\sin{\theta}&0\\-\sin{\theta}&\cos{\theta}&0\\0&0&1\end{bmatrix}
\]把原本的$A^TMA$的$A^T$和$A$都套一下旋轉矩陣就行了