3
$\begingroup$

If I have one endpoint $(x_1,y_1)$ and the distance of the line segment, how do I calculate $(x_2,y_2)$? I also know the angle the line makes with the $x$ axis if that helps.

$\endgroup$
  • $\begingroup$ What do you mean by (x2, y2)? Do you mean the other endpoint of the line segment? $\endgroup$ – Nick Feb 27 '15 at 23:38
2
$\begingroup$

Draw a line perpendicular to the x-axis and that passes through $(x_1,y_1)$. Construct a perpendicular line to the y-axis that passes through $(x_2,y_2)$. You'll get a right triangle. Now I guess you can use the sine and the cosine of the angle to find the length of the sides of the triangle. What are the lengths of the sides of the triangle?

$\endgroup$
0
$\begingroup$

This question is tagged with Linear Algebra, so I'll give an answer in terms of vector operations.

Let's call the endpoints $\vec u$ and $\vec v$, the distance $d$, and the angle $\theta$.

If $\vec u$ and $\vec v$ are $d$-distance apart, so are $\vec 0$ and $(\vec v - \vec u)$.

If $\vec u$ and $\vec v$ form a $\theta$-angle with the $x$-axis, so do $\vec 0$ and $(\vec v - \vec u)$.

If we rotate $(\vec v - \vec u)$ clockwise by $\theta$, we get a vector $(d, 0)$. Likewise, if we rotate $(d, 0)$ counterclockwise by $\theta$, we get $(\vec v - \vec u)$.

$$ \left[\begin{array} \\ \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \\ \end{array}\right] \left[\begin{array} \\ d \\ 0 \end{array}\right] = \vec v - \vec u $$

$$ \left[\begin{array} \\ \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \\ \end{array}\right] \left[\begin{array} \\ d \\ 0 \end{array}\right] + \vec u= \vec v $$

There you have it.

$\endgroup$
0
$\begingroup$

There are two possible answers if the length (what I think you mean by “distance of the line segment”) is positive. Let the (non-obtuse) angle between the line determined by the segment and the $x$-axis be $\theta$ and let the length of the segment be $d$.

The direction from $(x_1,y_1)$ to $(x_2,y_2)$ is either the direction from the origin to the point $(\cos\theta,\sin\theta)$, which is a distance of $1$ unit from the origin, or else it’s the opposite direction (the direction from the origin to the point $(-\cos\theta,-\sin\theta)$).

So from $(x_1,y_1)$, go $d$ units in one of those directions, which is the same as adding either $(d\cos\theta,d\sin\theta)$ or $(-d\cos\theta,-d\sin\theta)$ to $(x_1,y_1)$ to get to $(x_2,y_2)$.

The two solutions are $(x_1+d\cos\theta,y_1+d\sin\theta)$ and $(x_1-d\cos\theta,y_1-d\sin\theta)$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.