# compute 3D point on a vector

This topic is 2499 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,
I would like to know how do to the following..I have a point in 3D space A(x,y,z) and another point B(x,y,z) If I travel from point A towards point B at a set velocity (meters per second) I would like to calculate at any given time the point position on the vector between A and B.. C(x,y,z)

I already know how to calculate the distance between A and B so I have that and I know the speed.. I probably could find it with google but I dont really know how to describe it for a search.. so far I have not had any luck finding it..Thanks.

##### Share on other sites
C = time * velocity + A

##### Share on other sites
The difference vector d from point A to point B
d := B - A
denotes the direction from A to B and the distance between A and B (i.e. the length of the vector). Dividing d by its own length (i.e. normalizing it)
d' := d / |d|
results in just the direction (i.e. the steps in all dimensions related to the unit distance).

This direction should be used as the direction of the velocity, too. So, scaling this direction with the speed s gives the velocity vector
v := d' * s

A position C is reached after t time units by integrating the velocity v over time
C(t) := Int( v(t) dt , 0, t)
where, in the given case, v is independent on time here and C starts at A = C(t=0), so that
C(t) := A + v * t
as Cornstalks has already stated above.

At t=T the position C(t) will reach B
C(t=T) = A + v * T = B
so that
v * T = B - A
d / |d| * s * T = d
|d|[sup]2[/sup] / |d| * s * T = |d|[sup]2[/sup]
and finally
T = |d| / s
is the expected duration of traveling (of course).

##### Share on other sites
Thank you Cornstalks and Haegarr I was not sure how to create a velocity vector that would not wander off from the vector between A and B.This information helped a lot..thanks for helping me out.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013735
×