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.

enter image description here

  • $\begingroup$ @alkabary Thank you for the markup! $\endgroup$ Commented Jun 6, 2015 at 1:44
  • $\begingroup$ no problem ;) chris $\endgroup$
    – alkabary
    Commented Jun 6, 2015 at 1:45
  • $\begingroup$ Welcome to math stackexchange. We love to help answer questions, but we expect you to show your own attempts. In part, this is to help us to tailor a response appropriate to your understanding. Can you please edit your post to include what you have tried? For example, can you make any right triangles and apply trig that you know to find things like side lengths, etc? $\endgroup$
    – TravisJ
    Commented Jun 6, 2015 at 1:46
  • $\begingroup$ @TravisJ The problem is the tilting part of the whole thing, I am not sure how to incorporate that into the calculation. I could do it if the arrow was pointing directly upright, but that is not the case. $\endgroup$ Commented Jun 6, 2015 at 1:59
  • $\begingroup$ Some nice links I found for drawing arrows: answers.opencv.org/question/130353/…, blog.csdn.net/yfqvip/article/details/50522215 $\endgroup$
    – user
    Commented Jun 5, 2017 at 21:16

4 Answers 4



\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}


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}


Hint: Draw a line from $(x_3,y_3) \to (x_1,y_1)$, then use trigonometry to find out the angle $x_2x_1x_3$. Then use more trig to find the equation of the line that connects $(x_3,y_3) \to (x_1,y_1)$, and also the equation from $(x_3,y_3) \to (x_2,y_2)$, then solve the system of equations to find $(x_3,y_3)$

The process is similar for $(x_4,y_4)$.


Using the scalar product, notice that

$$(x_1-x_2)(x_3-x_2)+(y_1-y_2)(y_3-y_2) = L_1 L_2 \cos \theta$$


$$(x_1-x_2)(x_4-x_2)+(y_1-y_2)(y_4-y_2) = L_1 L_2 \cos \theta \; .$$

as well as equations related to the length

$$(x_3-x_2)^2+(y_3-y_2)^2 = L_2^2$$


$$(x_4-x_2)^2+(y_4-y_2)^2 = L_2^2$$

You can thus solve these equations in $(x_3,y_3)$ and $(x_4,y_4)$. Note that they really are the same pair of equations (eq 1 & eq 3 w.r.t. eq 2 & eq 4) which means that those equation have 2 solutions which are related to different possible orientations of your angles $\theta$. You can filter out which solution is which by looking at their location with respect to $(x_1,y_1)$ and $(x_2,y_2)$.

Let me expand a bit on the answer. So my equations are

$$(x_1-x_2)(x-x_2)+(y_1-y_2)(y-y_2) = L_1 L_2 \cos \theta$$


$$(x-x_2)^2+(y_3-y_2)^2 = L_2^2$$

Now, introduce $(x-x_2)=X$ and $(y-y_2)=aX$. The equations become

$$(x_1-x_2)X+(y_1-y_2)aX = L_1 L_2 \cos \theta$$


$$X^2+a^2X^2 = L_2^2$$

The first equation gives

$$X = \frac{L_1 L_2 \cos \theta}{(x_1-x_2)+(y_1-y_2)a}$$

which you can substitute in the second to give an equation of second degree in $a$ only.

$$(1+a^2)(L_1 L_2 \cos \theta)^2 = L_2^2 ((x_1-x_2)+(y_1-y_2)a)^2$$

This will have two solutions for $a$.

  • $\begingroup$ For you first set of equations, how do I solve for two unknowns? $\endgroup$ Commented Jun 6, 2015 at 2:29
  • $\begingroup$ I made an edit. $\endgroup$ Commented Jun 6, 2015 at 2:38

Hint: draw a horizontal ray from $(x_1,y_1)$ define $\phi$ as the angle from the ray to the segment of length L1. Extend the right hand side of the arrowhead down until it crosses the ray. Then the third angle of the triangle (from the ray to the extended arrowhead) is $\phi'=\pi-\theta-\phi$ This is also the angle the extended arrowhead makes with the $x$ axis. Then $x_4=x_2+L_2\cos (\pi-\theta-\phi), y_4=y_2+L_2\sin(\pi-\theta-\phi)$ I leave $(x_3,y_3)$ to you. It works the same.

enter image description here

  • $\begingroup$ Nice explanation, but what happens if the arrow points so far to the left that you cannot extend it to meet the ray? $\endgroup$ Commented Jun 6, 2015 at 2:22
  • $\begingroup$ You use a line,then it will always meet unless it is parallel to the $x$ axis. I thought a ray would paint a clearer picture, but a line is more correct. $\endgroup$ Commented Jun 6, 2015 at 2:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .