Reflect a point over a line in 3D using a matrix transformation

1.7k Views Asked by At

In a 2D plane I can use the reflection matrix below to reflect about line $y=(\tan(\theta))x$ enter image description here

Is there an equivalent matrix for reflecting about a 3D line in the form $r=\lambda a+b$?

2

There are 2 best solutions below

0
On

In 3-space, there is an elaborate theory of reflections about planes but you can also reflect about a line or a point. Take a point $P=(x_1,y_1,z_1)$ and your line $\ell$ with parametric equations$$x=b_1+\lambda a_1,y=b_2+\lambda a_2,z=b_2+\lambda a_2.$$ We wish to find the foot $(x_*,y_*,z_*)$ of the perpendicular from $P$ to $\ell.$ The vector from $P$ to a point on $\ell$ is $$[b_1+\lambda a_1-x_1,b_2+\lambda a_2-z_1,b_3+\lambda a_3-z_1].$$ A vector in the direction of the line $\ell$ is $[a_1,a_2,a_3]$. The condition for perpendicularity is $$[a_1,a_2,a_3]\bullet [b_1+\lambda a_1-x_1,b_2+\lambda a_2-z_1,b_3+\lambda a_3-z_1]=0.$$ Solve this equation for $\lambda$ and substitute that value into the parameric equations for $\ell$. The resulting values of $x,y$ and $z$ are $x_*,y_*$ and $z_*$ respectively. Let the reflected point be $(x_1',y_1',z_1').$ Then $$x_1'-x_*=x_*-x_1,y_1'-y_*=y_*-y_1,z_1'-z_*=z_*-z_1.$$ Thus $$x_1'=2x_*-x_1,y_1'=2y_*-y_1,z_1'=2z_*-z_1.$$ The result can be expressed in the form $$\begin{bmatrix}x_1'\\y_1'\\z_1'\end{bmatrix}=M\begin{bmatrix}x_1\\y_1\\z_1\end{bmatrix}+\mathbf v$$ where $M$ is a 3x3 matrix and $\mathbf v$ is a 3-entry column vector.

0
On

The line is given by $r = \lambda a + b $ with $\lambda \in \mathbb{R} $ and $a, b$ fixed vectors. Given a point $P_1$, its projection on the line is

$ Q = b + \left( \dfrac{ (P_1 - b) \cdot a }{a \cdot a } \right) a $

So the reflection of $P_1$ about the line is

$P_2 = P_1 - 2 (P_1 - Q) = 2 Q - P_1 = 2 b + 2 \dfrac{ {a a}^T }{a^T a} (P_1 - b) - P_1 = b + \big( 2 \dfrac{{a a}^T}{a^T a} - I \big) (P_1 - b) $

Let matrix $M = 2 \dfrac{{a a}^T}{a^T a} - I $, then

$P_2 = b + M (P_1 - b) $

Another way to get to the same results is by rotation by $180^\circ$ about the axis having a unit vector $\dfrac{a}{\sqrt{a^T a}} $. It is known that the rotation of a point $P$ about an axis with direction given by the unit vector $u$ and passing through a point $b$ is given by

$ R = {u u}^T + (I - {u u}^T ) \cos(\theta) + S_u \sin(\theta) $

where $S_u$ is the skew-symmetric matrix corresponding to cross product of $ u$ with a vector. Since $\theta = 180^\circ$, then the above becomes

$R = 2 {u u}^T - I$

Now substitute $ u = \dfrac{a}{\sqrt{a^T a} } $

$R = 2 \dfrac{ {a a}^T }{a^T a} - I $

And therefore, the image of $P_1$ is

$P_2 = b + R (P_1 - b) $

Note that $R$ is identical to matrix $M$ obtained above.