# Finding the coordinates of points given the vertical length of a line and the angles between them

The figure below describes a robot moving in a vertical plane $$(x, y)$$ with two degrees of freedom: one vertical translation of length $$q_1$$ and one rotation of angle $$q_2$$ measured with respect to the horizontal line $$x$$. How can we obtain the coordinates $$(x_1, y_1)$$ and $$(x_2, y_2)$$ of the points $$P_1$$ and $$P_2$$ as functions of $$q = (q_1, q_2)$$, considering that the point $$P_0$$ is fixed at the coordinates $$(0,0)$$ and that the length $$P_1 P_2$$ is 1 meter?

Let's call $$t$$ the angle from the $$x$$-axis counterclockwise to the arrow from $$P_0$$ to $$P_1$$. It's 90 degrees, or $$\pi/2$$, or whatever you want to call it. But that makes the point $$P_1$$ be
\begin{align} P_1 &= P_0 + q_1 (\cos t, \sin t) \\ &= (0,0) + q_1 (\cos t, \sin t) \\ &= (0 + q_1 \cos t,0 + q_1 \sin t). \end{align}
And you can use the same approach to find the coordinates of $$P_2$$, starting from $$P_1$$>