Formula for finding point on a line given distance along a line


by physicisTboB
Tags: distance, formula, line, point
physicisTboB
physicisTboB is offline
#1
Aug1-10, 02:36 AM
P: 6
So for a while i have been wondering if there was a way to find a point a certain distance along a linear function, so I decided that with my extreme pre-calc level of math that I would try and write an equation for it. long story short I would appreciate it if someone would take a look at the equation and try and figure out where I goofed up. The equation I came up with is:
c = sqrt((ox+a)^2+(m*(ox+a)+b-oy)^2)
where
c is the distance of the hypotenuse of a triangle with coords (ox,oy),(ox+a),(ox+a,f(ox+a))
a is the distance of the horizontal leg of the triangle
m, b are the slope and y-intercept of the line respectively
ox, oy are the original x and y coords on the line
px, py are the projected coords along the line
z is the distance along the line to the new projected point

deltax = (a*z)/c
where
deltax is the distance to the new point along the x-axis

px = deltax + ox
py = m(deltax+ox)+b
where
px, py are the projected coords along the line

I hope this post isn't too incomprehensible seeing as I'm writing this at 12:30
Phys.Org News Partner Mathematics news on Phys.org
Researchers help Boston Marathon organizers plan for 2014 race
'Math detective' analyzes odds for suspicious lottery wins
Pseudo-mathematics and financial charlatanism
Mentallic
Mentallic is offline
#2
Aug1-10, 02:53 AM
HW Helper
P: 3,436
I have to admit you should have written it out at another time

If you let your starting point be [tex](x_o,y_o)[/tex] on your line [tex]y=mx+b[/tex] and a distance d along this line to the new point [tex](x,y)[/tex] then you have equations:

[tex]d=\sqrt{(x-x_o)^2+(y-y_o)^2}[/tex] by the distance formula

[tex]m=\frac{y-y_o}{x-x_o}[/tex] for the gradient formula

Now all you need to do is solve these two equations simultaneously for x and y (m, d, yo, xo are all constants you know).
arildno
arildno is offline
#3
Aug1-10, 03:39 AM
Sci Advisor
HW Helper
PF Gold
P: 12,016
Note that from the second equation Mentallic gave you,
[tex](y-y_{0})=m(x-x_{0})[/tex]

Use this in your first equation to solve for x (you will get 2 solutions)

HallsofIvy
HallsofIvy is offline
#4
Aug1-10, 06:56 AM
Math
Emeritus
Sci Advisor
Thanks
PF Gold
P: 38,886

Formula for finding point on a line given distance along a line


Essentially what you are doing is finding the intersections of the line [itex]y- y_0= m(x- x_0)[/itex] and the circle [itex](x-x_0)^2+ (y- y_0)^2= c^2[/itex].

Replacing y in the circle equation by [itex]y_0+ m(x- x_0)[/itex] gives the quadratic equation [itex](x- x_0)^2+ m^2(x- x_0)^2= c^2[/itex] which can be factored as [itex](x- x_0)^2(1+ m^2)= c^2[/itex] and so [itex](x- x_0)^2= c^2/(1+m^2)[/itex] and, finally,
[tex]x= x_0+ \frac{c}{\sqrt{1+m^2}}[/tex]
Mentallic
Mentallic is offline
#5
Aug1-10, 07:18 AM
HW Helper
P: 3,436
Quote Quote by HallsofIvy View Post
... and so [itex](x- x_0)^2= c^2/(1+m^2)[/itex] and, finally,
[tex]x= x_0+ \frac{c}{\sqrt{1+m^2}}[/tex]
Being a little more pedantic, [tex]x=x_0\pm\frac{c}{\sqrt{1+m^2}}[/tex] and so

[tex]x=x_0+\frac{c}{\sqrt{1+m^2}} , x>x_0[/tex]

[tex]x=x_0-\frac{c}{\sqrt{1+m^2}} , x<x_0[/tex]

since c is the distance (a positive value) and [tex]\sqrt{1+m^2}[/tex] is also positive for all real m.
wil3
wil3 is offline
#6
Aug1-10, 09:22 AM
P: 181
I don't know if I read the meaning of your constants and variables right, but it seems like the equation should be:

c = sqrt((a)^2+(m*(ox+a)+b-oy)^2)

instead of:

c = sqrt((ox+a)^2+(m*(ox+a)+b-oy)^2)

If all you're doing is using the Pythagorean theorum, and a is just the horizontal leg of the triangle.

PS- try Latex in your posts- all you have to do is go into advanced reply mode, and use the tags [tex] and [/tex] at the start and end of your equation. It makes things look pretty!
Mentallic
Mentallic is offline
#7
Aug1-10, 09:44 AM
HW Helper
P: 3,436
Whether what he did was correct or not so far, the fact is that he wants to find the point that is a certain distance from some other point along a straight line. This implies that he wants coordinates (x,y) in terms of d=distance, m=gradient, (xo,yo)=initial point. And I'm just not seeing that.

p.s. I gave the the OP's work another little glance and I'm looking away again. I'm simply afraid of delving into it...

Quote Quote by physicisTboB View Post
c is the distance of the hypotenuse of a triangle with coords (ox,oy),(ox+a),(ox+a,f(ox+a))
a is the distance of the horizontal leg of the triangle
px = deltax + ox
px, py are the projected coords along the line
From what I can gather, a=deltax ? If they're the same then you shouldn't be introducing different names for the same thing, it just makes things more confusing.
And it would have been more appealing to read if you had used subscripts. the intial point (xo,yo) shouldn't be expressed as (ox,oy) since this suggests o times x and o times y. Then we wonder what the hell o is.
wil3
wil3 is offline
#8
Aug1-10, 09:51 AM
P: 181
Chill, we were all in high/middle school once- I don't know of that many people who natively speak Latex. I only just learned how to use it myself a few weeks ago.

I think my correction may be on the right track- OP, would you mind clarifying what c and z are exactly? I think of c as just the hypotenuse/distance.
physicisTboB
physicisTboB is offline
#9
Aug1-10, 01:11 PM
P: 6
So heres the equation with wil3's correction (with latex =D)
c = [tex]\sqrt{((a)^2+(m*(x_o+a)+b-y_o)^2)}[/tex]
a, and c exist to establish legs of a triangle to get a ratio of line length to horizontal length,
and yes I found this using the Pythagorean theorem.
deltax is the horizontal distance from [tex]x_{o}[/tex] to [tex]p_{x}[/tex],
whereas a is the arbitrarily set value to use in the Pythagorean theorem.
And yes I suppose you could do this using a circle and whatnot.
Mentallic
Mentallic is offline
#10
Aug1-10, 08:43 PM
HW Helper
P: 3,436
Quote Quote by wil3 View Post
Chill
Actually I barely got any sleep last night because of this

Quote Quote by physicisTboB View Post
So heres the equation with wil3's correction (with latex =D)
c = [tex]\sqrt{((a)^2+(m*(x_o+a)+b-y_o)^2)}[/tex]
a, and c exist to establish legs of a triangle to get a ratio of line length to horizontal length,
and yes I found this using the Pythagorean theorem.
deltax is the horizontal distance from [tex]x_{o}[/tex] to [tex]p_{x}[/tex],
whereas a is the arbitrarily set value to use in the Pythagorean theorem.
And yes I suppose you could do this using a circle and whatnot.
Ok, but this is what you said in your OP:

Quote Quote by physicisTboB View Post
So for a while i have been wondering if there was a way to find a point a certain distance along a linear function
Now your solution that you've shown us, without even checking to see if it's correct, is an equation to solve for c (the distance). This is because if you have c=something, then you plug in all the known values into the something then it spurts out your value of c, but you don't want that. You want to find a point (x,y) a distance c from an initial point (x0,y0).
physicisTboB
physicisTboB is offline
#11
Aug1-10, 10:39 PM
P: 6
No, c isn't the distance along the line, c is the hypotenuse of the triangle that is used to find the ratio of the x length to the distance along the line. Then using this ratio:
deltax the total change in x
c the hypotenuse of the triangle
a the horizontal leg of the triangle
z the distance to travel along the line

deltax/z = a/c

deltax = az/c
Mentallic
Mentallic is offline
#12
Aug1-10, 11:44 PM
HW Helper
P: 3,436
Oh I see what you mean now, but I still don't understand why you would need to do that. Why make a small right triangle with hypotenuse c and horizontal length x when the distance between your starting and ending point is a larger right triangle with hypotenuse z and horizontal length [itex]\Delta x[/itex]. Sure you can find a relationship between the small and larger triangles by similarity, but what's the point? You've just introduced more variables which aren't necessary and just make things more cumbersome.

Is the answer
[tex]
\sqrt{((a)^2+(m*(x_o+a)+b-y_o)^2)}
[/tex]
what you were looking for? Hallsofivy and I have pretty much given you the answer to your question (at least I think we did), it just depends on what your question actually was.
HallsofIvy
HallsofIvy is offline
#13
Aug2-10, 06:21 AM
Math
Emeritus
Sci Advisor
Thanks
PF Gold
P: 38,886
Quote Quote by physicisTboB View Post
No, c isn't the distance along the line, c is the hypotenuse of the triangle that is used to find the ratio of the x length to the distance along the line.
You said before, "c is the distance of the hypotenuse of a triangle with coords (ox,oy),(ox+a),(ox+a,f(ox+a))". If y= f(x) is the equation of the line, then that hypotenuse lies along the line and c is the distance along the line.

Then using this ratio:
deltax the total change in x
c the hypotenuse of the triangle
a the horizontal leg of the triangle
z the distance to travel along the line

deltax/z = a/c

deltax = az/c
physicisTboB
physicisTboB is offline
#14
Aug2-10, 08:57 AM
P: 6
C does lie on the line, however it is not the total distance to the point.
wil3
wil3 is offline
#15
Aug2-10, 08:59 AM
P: 181
Would you mind posting a picture or diagram with all the variables/constants labeled? This thread has proven to be a lot more interesting than I expected, but I know that at least I am a little bit confused as to the specific meaning of some of your variables. Thank you very much!
Mentallic
Mentallic is offline
#16
Aug2-10, 09:50 AM
HW Helper
P: 3,436
Quote Quote by physicisTboB View Post
C does lie on the line, however it is not the total distance to the point.
And what is the point of this? You could go even further and create multiple points with varying distances along the line, each not quite reaching the required distance. Why would you do this though? Sure they all have similar triangle properties, but,

[tex]\frac{\Delta x}{z} = \frac{a}{c}[/tex]

Doesn't tell us anything useful, since we're comparing our required sides of the triangle on the left side with a redundant triangle.

Would you mind please taking a look at my previous post and specifically this part,

Quote Quote by Mentallic View Post
Is the answer
[tex]
\sqrt{((a)^2+(m*(x_o+a)+b-y_o)^2)}
[/tex]
what you were looking for? Hallsofivy and I have pretty much given you the answer to your question (at least I think we did), it just depends on what your question actually was.
Mentallic
Mentallic is offline
#17
Aug2-10, 09:55 AM
HW Helper
P: 3,436
This is how I interpreted the variables. Note that the question the OP asked implies that we are searching for the point (px,py) given we know (ox,oy), y=mx+b and z.



Uploaded with ImageShack.us
physicisTboB
physicisTboB is offline
#18
Aug3-10, 12:21 AM
P: 6
Yeah, thats it I guess you've been right that I didn't have to do that first ratio with the a and c. I never really saw it like that, thanks.


Register to reply

Related Discussions
Distance of a point from a line (3-D) Calculus & Beyond Homework 8
Finding a point on a line, given another point on the same line, and knowing its dist Precalculus Mathematics Homework 4
Determine point on line where normal passes thr a point intersects the line. Calculus & Beyond Homework 7
point line and the distance Calculus & Beyond Homework 2
distance from point to line Precalculus Mathematics Homework 3