0
43kviews
Derive the matrix in 2D for Reflection of an object about a line y=mx+c.
7
6.0kviews

Equation of Line : $y = mx + c$

slope = m $\quad$ y intercept = c

we can relate slope m to angle $\theta$ by equation

m = tan$\theta$

$\therefore$ $\theta$ = $tan^{-^1}$m

where $\theta$ is in inclination of line with respect to x-axis.

Translation matrix can be given as

T = $\left[ \begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & -c & 1 \\ \end{matrix} \right]$

Rotation matrix to match the given line with x-axis can be obtained as

$R_z$ = $\left[ \begin{matrix} cos\theta & -sin\theta & 0 \\ sin\theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{matrix} \right]$

M = $\left[ \begin{matrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \\ \end{matrix} \right]$

Inverse transformation matrices,

$R_z^{-^1}$ = $\left[ \begin{matrix} cos\theta & sin\theta & 0 \\ -sin\theta & cos \theta & 0 \\ 0 & 0 & 1 \\ \end{matrix} \right]$ $T^{-^1}$ = $\left[ \begin{matrix} 1 & 0 & 0 \\ 0 & 1 & -c \\ 0 & 0 & 1 \\ \end{matrix} \right]$

$\therefore$ Final transformation matrix can be obtained as,

$\qquad R_T = T \cdot {R_z \cdot M \cdot R_z^{-^1} \cdot T^{-^1}}$

As we have tan$\theta$ = m, using trigonometric identities we can obtain,

$sin \theta = \frac{m}{\sqrt {m^3 + 1}}$ $\qquad$ $cos \theta = \frac{m}{\sqrt {m^3 + 1}}$

$\therefore$ $R_T$ = $\left[ \begin{matrix} cos2\theta & sin2\theta & 0 \\ sin2\theta & -cos2\theta & 0 \\ -csin2\theta & c(1+cos2\theta) & 1 \\ \end{matrix} \right]$

By Substituting values of $sin\theta$ and $cos\theta$ we have

$R_T$ = $\left[ \begin{matrix} \frac{1-m^2}{m^2 + 1} & \frac{2m}{m^2 + 1} & 0 \\ \frac{2m}{m^2 + 1} & \frac{m^2 - 1}{m^2 + 1} & 0 \\ \frac{-2cm}{m^2 + 1} & \frac{2c}{m^2 + 1} & 1 \\ \end{matrix} \right]$