This problem came up while discussing using a simplex to solve systems of equations.
(By the way, yes, this is very similar to this one.)
Given three points, how do I find the location of the point that results from reflecting one of them over the line between the other two?
This is what I mean:
How do I find $C'$?
Best Answer
For reference:
Let...
$\vec{P} = \langle x-a, y-b \rangle$
$\vec{Q} = \langle c-a, d-b \rangle$
$\theta = \text{ the angle between } \vec{P} \text{ and } \vec{Q}$
First off, let's start with projecting $\vec{P}$ onto $\vec{Q}$. In math...
$\vec{K} = \text{Proj}_{\vec{Q}} \vec{P} = \displaystyle \frac{\vec{P} \cdot \vec{Q}}{||\vec{Q}||^2} \vec{Q}$
This gives us the vector $\vec{K}$ that goes from $A$ to the "intersection" of the two lines $\overline{AB}$ and $\overline{CC'}$. To find the vector from $C$ to that intersection, simply subtract $\vec{K}$ from $\vec{P}$. You can then multiply this vector by two and add to $C$ to get $C'$, or in other words $2(\vec{K}-\vec{P}) + \vec{P}$. This is equivalent to $2\vec{K}-\vec{P}$. Substituting the formula for $\vec{K}$ back in gives:
$\vec{P'} = \displaystyle 2\frac{\vec{P} \cdot \vec{Q}}{||\vec{Q}||^2} \vec{Q} - \vec{P}$
You can now add $\vec{P'}$ to $A$ to get $C'$. That sufficient for your needs?