2D 运动矢量 - 计算对象在给定时间的位置

2D Motion vectors - calculate location of object at a given time

我在给定时间移动某些对象时无法理解 2D 运动矢量。我对线性代数的了解有限,我真的不知道要查找的确切搜索词,所以我想知道是否有人可以帮助我或至少在正确的方向上提示我。

我的问题是这样的:

我在 space 中有两个点,一个起点和一个终点。它们各有一个特定的位置,分别表示为 (x_1、x_2) 和 (y_1、y_2)。这两个点都附有时间,分别命名为 t_startPoint 或 t_endPoint。我现在想知道,对于给定的 currentTime(= 基本上是 t_startPoint 和 t_endPoint 之间的任何时间点),新点 N 在这些点之间的连接线上的确切位置两点。我知道描述不是微不足道的,这就是为什么我还添加了一张图片来描述我想做的事情:

到目前为止,这是我的算法:

函数更新(_时间:Int64){

    let t_startPoint: Int64 = 1
    let position_startPoint: = (1.0, 1.0)

    let t_endPoint: Int64 = 5
    let position_endPoint: Vector = (4.0, 5.0) 

    let currentTime = 3

    let duration = t_endPoint - t_startPoint

    let x = position_startPoint.x + ((position_endPoint.x - position_startPoint.x) / Float(duration)) * (Float(currentTime - t_startPoint))
    let y = position_startPoint.y + ((position_endPoint.y - position_startPoint.y) / Float(duration)) * (Float(currentTime - t_startPoint))

    //

然而,无论我做什么,我的对象总是超调,不规律地来回移动,我不知道从哪里开始。任何帮助将不胜感激!

恒速运动有关系:

 (t-t1) / (t2-t1) = (x-x1) / (x2-x1) 
 x = x1 + (x2-t1) * (t-t1) / (t2-t1)    

所以你的表情看起来是对的。检查:

1 + (4-1) * (3-1) / (5-1) = 1 + 3 * 2 / 4 = 2.5 - exact middle, OK