Hi,
I have a straight line whose start and end points are known. (Pt1 and Pt2)...
Is it possible to calculate the coordinates of a point that is on on this straight line at a distance of 1000 from pt1 or pt2...
thanks
Hi,
I have a straight line whose start and end points are known. (Pt1 and Pt2)...
Is it possible to calculate the coordinates of a point that is on on this straight line at a distance of 1000 from pt1 or pt2...
thanks
Hi jhevon,
thank you for your comment...
I need to write a program what could calculate the values as described in the topic...
If I were to calculate,
Distance Formula: Dist ^2 = (y2-y1)^2 + (x2-x1)^2
and substituting y=mx+c in the above equation...
This looks little tedious programmatically; I am wondering if there are any alternate ways of solving the problem...
thanks
Suppose that P(a,b) & Q(c,d) are the end points of the line segments.
Define $\displaystyle D = \sqrt {\left( {a - c} \right)^2 + \left( {b - d} \right)^2 }$.
Now define $\displaystyle l(t) = \left( {a + t\frac{{c - a}}{D},b + t\frac{{d - b}}{D}} \right)\quad ,t \in \mathbb{R}$, equation of the line determined by P & Q.
Note that $\displaystyle l(D) = Q$ so that $\displaystyle l(1000)$ is the point 1000 units from P in the Q direction.
Whereas $\displaystyle l(-1000)$ is the point 1000 units from P in the direction opposite of Q (that is P is between that point and Q).
If you need distances from Q then just change the definition of the line.