Hi,
I've been frustratingly stuck with the math for this, and was hoping someone could help out.
I have two points: A,B in 3D space (and therefore a line between them).
I'm looking for a third point, C, along this line, a specific distance away from point B. But in the direction of point C.
How do I find this point?
I've tried using similar triangles, and parametric line equations but I'm getting strange results, and I'm not sure if it's borked code or borked math... Trying to verify the math, or find a better way of doing this.
Thanks in advance!
Find point on a line, given distance?
Started by dnatapov, Apr 01 2008 08:06 AM
5 replies to this topic
Ad:
#5 Members - Reputation: 122
Posted 01 April 2008 - 10:03 AM
Quote:
Original post by Bob Janova
Use vectors. C = B - k(A - B). k = (the distance you want) / (distance from A to B), or k = proportion of distance to place C (0: place at B; 1: place at A).
e: bad bold tag polarity
Ah there it is!
I was doing C = A + k(A - B);
It seems to work now. Thanks a lot for the help! :D
#6 Members - Reputation: 435
Posted 01 April 2008 - 10:14 AM
Quote:
Original post by dnatapov Quote:
Original post by Bob Janova
Use vectors. C = B - k(A - B). k = (the distance you want) / (distance from A to B), or k = proportion of distance to place C (0: place at B; 1: place at A).
e: bad bold tag polarity
Ah there it is!
I was doing C = A + k(A - B);
It seems to work now. Thanks a lot for the help! :D
That's how I would've done it, except it's C = A + k(B - A). A is the starting point, (B - A) is the vector pointing in the direction of B if you take A as the origin.






