Find the better intersection of two moving objects

前端 未结 4 780
灰色年华
灰色年华 2021-02-19 07:03

I would like to optimize dramaticaly one of my algorithm, i will try to explain it the best way that i can.

The subject

We are in a 2D euclidian system at the

4条回答
  •  你的背包
    2021-02-19 07:45

    Update: @Meriton's later answer is better than mine. I recommend trying his first.

    As you realize, we have three, simultaneous equations in the three unknowns vx2, vy2 and t -- respectively the x and y velocities of 02, and time. The equations unfortunately are not all linear:

    x1o + vx1*t == x2o + vx2*t
    y1o + vy1*t == y2o + vy2*t
    vx2*vx2 + vy2*vy2 == vy*vy
    

    (Here, x1o, y1o, x2o and y2o are coordinates of the initial positions.)

    If there is a way to linearize the problem, I don't see it. You can however solve iteratively, and quickly, by the same Newton-Raphson technique GPS uses to work out your position from satellite signals. Of course, to fill in the details and implement this will demand some work!

    Update: I think that @Alnitak may have linearized your problem rather neatly. Perhaps a combination of his approach and mine therefore would prosper. (I still think that you'll want to use a Newton-Raphson iteration to converge on @Altinak's T.)

提交回复
热议问题