Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

Login

Username

Password

Not registered yet?

#1 2008-03-25 07:45:57

Zenith
Novice

Offline

Calculate a point along a line

I have tried to solve this problem for a while now, and I always seem to get the wrong answer. I really need help.

Two points form a line. How do I find the the x and y coordinates of a point that is n units from one point going towards the other point along the line?

Diagram:

        n
  _________________________
A              B                          C

How do you find where B is? I turn the line into a triangle and use similar edges of it to find the answer. However, this do what I need; I want to use some sort of equation/rule to find the location of B.

#2 2008-03-25 08:33:57

mathsyperson
Moderator

Offline

Re: Calculate a point along a line

Let's say that point A is (a,b) and point C is (c,d).

To get from A to C, you need to go (c-a) units to the right, and (d-b) units up.
So the equation of the line that contains points A and C is (a,b) + t(c-a,d-b), where t is some parameter. (This is because every point on the line can be made by starting at point A and then moving some distance parallel to the line AC.)

You can also find the length AC by Pythagoras: AC = √[(c-a)²+(d-b)²].
By introducing a new variable L and saying that t = L/AC, you get the equation of the line joining A and C to be (a,b) + L/AC(c-a,d-b). This time, L indicates the distance from point A (in the direction of C).

Hence, substituting your value of n into L will get your answer.

(Hopefully I've explained that well enough. Feel free to post again if I've been unclear.)


Why did the vector cross the road?
It wanted to be normal.

#3 2013-03-06 08:31:07

mikkel
Guest

Re: Calculate a point along a line

That was extremely helpful for my game project I am doing, so glad I found this explanation thank you!! up:D

Board footer

Powered by FluxBB