Reflection in an affine hyperplane (source code)

= Reflection in an affine hyperplane
{title2=$x\mapsto x-2\frac{n^Tx-d}{n^Tn}n$}

= Affine reflection
{synonym}

For a nonzero real normal <vector> $n$, orthogonal reflection in $n^Tx=d$ has the displayed <affine map>. It is $x\mapsto Hx+t$ with $H=I-2nn^T/(n^Tn)$ and $t=2dn/(n^Tn)$. In <homogeneous coordinates> its matrix is
$$
\begin{pmatrix}H&t\\0&1\end{pmatrix}.
$$
Every point on the hyperplane is fixed, and the signed normal displacement changes sign. Choosing any point $p$ on the hyperplane gives $t=p-Hp$, so translating by $-p$, applying the <reflection matrix> $H$ and translating back gives the same transformation.