TITLE: Drawing an arrow
QUESTION [9 upvotes]: Given values $L_1, L_2, x_1,y_1, x_2, y_2$ and $\theta$, calculate $x_3, y_3, x_4, y_4$. 
Basically, given a line, find the points of the tip of the arrow head. I have asked many people for help on this with no luck.
I have tried making a right triangle, and this would work if only the arrow was facing upright. But the angle of the arrow is unknown so that is my problem.

REPLY [7 votes]: Solution
\begin{align}
x_3&=x_2+\frac{L_2}{L_1}\bigl[(x_1-x_2)\cos\theta+(y_1-y_2)\sin\theta\bigr],\\
y_3&=y_2+\frac{L_2}{L_1}\bigl[(y_1-y_2)\cos\theta-(x_1-x_2)\sin\theta\bigr],\\
x_4&=x_2+\frac{L_2}{L_1}\bigl[(x_1-x_2)\cos\theta-(y_1-y_2)\sin\theta\bigr],\\
y_4&=y_2+\frac{L_2}{L_1}\bigl[(y_1-y_2)\cos\theta+(x_1-x_2)\sin\theta\bigr].
\end{align}
Explanation
Let's call $P_i$ the point of coordinates $(x_i,y_i)$, then
\begin{align}
P_3&=P_2+L_2\mathbf{v}_3,\\
P_4&=P_2+L_2\mathbf{v}_4
\end{align}
where 
$$
\mathbf{v}_3=(\cos(\theta_0-\theta),\sin(\theta_0-\theta)),\\
\mathbf{v}_4=(\cos(\theta_0+\theta),\sin(\theta_0+\theta))
$$
and $\theta_0$ is such that
$$
\mathbf{v}=\frac{P_1-P_2}{L_1}=(\cos\theta_0,\sin\theta_0).
$$
Then
\begin{align}
\cos\theta_0&=\frac{x_1-x_2}{L_1},\\
\sin\theta_0&=\frac{y_1-y_2}{L_1}
\end{align}
so that, using trigonometric addition formulas
\begin{align}
\mathbf{v}_3&=\left(\frac{x_1-x_2}{L_1}\cos\theta+\frac{y_1-y_2}{L_1}\sin\theta,\frac{y_1-y_2}{L_1}\cos\theta-\frac{x_1-x_2}{L_1}\sin\theta\right),\\
\mathbf{v}_3&=\left(\frac{x_1-x_2}{L_1}\cos\theta-\frac{y_1-y_2}{L_1}\sin\theta,\frac{y_1-y_2}{L_1}\cos\theta+\frac{x_1-x_2}{L_1}\sin\theta\right)
\end{align}
and finally
\begin{align}
x_3&=x_2+L_2\left(\frac{x_1-x_2}{L_1}\cos\theta+\frac{y_1-y_2}{L_1}\sin\theta\right),\\
y_3&=y_2+L_2\left(\frac{y_1-y_2}{L_1}\cos\theta-\frac{x_1-x_2}{L_1}\sin\theta\right),\\
x_4&=x_2+L_2\left(\frac{x_1-x_2}{L_1}\cos\theta-\frac{y_1-y_2}{L_1}\sin\theta\right),\\
y_4&=y_2+L_2\left(\frac{y_1-y_2}{L_1}\cos\theta+\frac{x_1-x_2}{L_1}\sin\theta\right),
\end{align}
or better written
\begin{align}
x_3&=x_2+\frac{L_2}{L_1}\bigl[(x_1-x_2)\cos\theta+(y_1-y_2)\sin\theta\bigr],\\
y_3&=y_2+\frac{L_2}{L_1}\bigl[(y_1-y_2)\cos\theta-(x_1-x_2)\sin\theta\bigr],\\
x_4&=x_2+\frac{L_2}{L_1}\bigl[(x_1-x_2)\cos\theta-(y_1-y_2)\sin\theta\bigr],\\
y_4&=y_2+\frac{L_2}{L_1}\bigl[(y_1-y_2)\cos\theta+(x_1-x_2)\sin\theta\bigr].
\end{align}