0
votes

A vehicle currently at a point U = (ux, uy) is moving counter-clockwise along a circle of radius R with speed s and direction d (i.e. tangent to the circle makes an angle d with the X-axis.) What position V = (vx, vy) will it be at in time t? The center of the circle is not specified. The way I see it, after time t it will travel st or an angle of st/R along the circle. But I am lost trying to compute V from this info. I can first find the center C of the circle based on (ux, uy), R and d. And then find where vector CV points, and hence V. But that's a whole lot of cosines and sines. I am constrained by CPU, so maybe one sine/cos/tan is acceptable or one or two squares/square roots are acceptable.

1
Can you talk a bit more about the setup in which you're solving this problem? I would imagine that unless you're doing this millions of times per second the cost of the sines and cosines wouldn't be too huge.templatetypedef
It's not so much one vehicle as it involves tracking thousands of vehicles in this manner and predicting if within time t, any two of them will collide with each other if they both keep following their current trajectory. The assumption is that if the vehicle is going straight then it will keep going straight; if it is turning then it will keep turning along a circle (since tim t is very short, a second or two.)Gambit
Getting theoretically exact results without at least 2 trigonometric functions will be very hard, I think. Perhaps you can use some lookup tables to get an approximation that works well enough for your context? Or a (piecewise?) polynomial approximation for the range you're dealing with?MvG
Since it's a short prediction, the angle never gets very big. If the angle stays small enough, sin(x) = x and cos(x) = 1 - 0.5x^2 are reasonable approximations. Is that good enough?harold
You can calculate positions after equal periods of time without extensive using of trig. functions, but that approach is not very useful for collision (the same time - the same position) purposesMBo

1 Answers

0
votes

This calls for a diagram, but alas I lack the skill.

I assume that the radius speed and time interval are such that the vehicle will not travel more than halfway round the circle in the time available.

Let V be the point the vehicle will be at t seconds after it is at U. Let the centre of the circle (whose coordinates will not be needed) be O. Then the length of the arc from U to V is

A = s*t

and so the angle subtended at O is

a = A/R radians. 

The direction from U to V will be the same as the direction of the tangent to the circle at a point midway between U and V, ie

e = d + a/2

The distance from U to V is the length of the chord from U to V. The midpoint of the chord is the vertex of two congruent right angled triangles whose hypoteneuses have length R, and the angle at O is a/2. Therefor the length of the chord is

C = 2*R*sin( a/2)

Finally

V = U + C*(cos(e), sin(e))

You may also want the direction of the tangent at V. This is d+a.

Note that if you store the direction d as a unit vector rather than an angle you can save some sin & cos calls as the direction of the chord is then the direction d rotated through a/2, and the direction at V is d rotated through a.