0

this is my first question on the forum and my algebra is rusty so please be indulgent ^^'

So my problem is that i want to predict collision between two uniform circular motion objects for which i know velocity (angular speed in radian), distance from the origin (radius), cartesian coordinate of the center of the circle.

I can get cartesian position for each object given for t time (timestamp) using :

Oa.x = ra X cos(wa X t)

Oa.y = ra X sin(wa X t)

Oa.x: Object A x coordinates ra: radius of a Circle A wa: velocity of object A (angular speed in radian) t: time (timestamp)

Same goes for object b (Ob)

I want to find t such that ||Ca - Cb|| = (rOa + rOb)

rOa: radius of object a

Squaring both side and expanding give me this : ||Ca-Cb||^2 = (rOa+rOb)^2

(ra * cos (wa * t) - rb / cos (wb * t))^2 + (ra * sin (wa * t) - rb / sin (wb * t))^2 = (ra+rb)^2

From that i should get a quadratic polynomial that i can solve for t, but how can i find a condition that tell me if such a t exist ? And possibly, how to solve it for t ?

Olivier
  • 13,283
  • 1
  • 8
  • 24
despe
  • 1
  • 1
  • This is probably a better fit on http://math.stackexchange.com/. – orlp Jul 12 '21 at 19:09
  • Ok, i will try there, thank you for answer. – despe Jul 12 '21 at 19:19
  • Same center for both trajectories? – Olivier Jul 12 '21 at 19:24
  • I'm pretty sure you'll just have to solve for t numerically, and that's the best you can do. – Noldorin Jul 12 '21 at 19:43
  • @Olivier no, both trajectories have different centers – despe Jul 12 '21 at 20:06
  • @Noldorin Yes, that's actually what i'm looking help for ^^' – despe Jul 12 '21 at 20:18
  • A method for finding the intersection point(s) of two circles is given in [this post](https://stackoverflow.com/questions/3349125/circle-circle-intersection-points). Once you know an intersection point, you can compute the first time that the object is at that point `t0`. Subsequent visits to the point are at times `t(k) = t0 + pk` where `p` is the period, and `k` is a positive integer. To find the collision you need to solve an equation like `7+3a = 2+5b`, which is known as a [linear Diophantine equation](https://en.wikipedia.org/wiki/Diophantine_equation). – user3386109 Jul 12 '21 at 22:06

1 Answers1

1

Your motion equations are missing some stuff I expect this instead:

a0(t) = omg0*t + ang0
x0(t) = cx0 + R0 * cos(a0(t))
y0(t) = cy0 + R0 * sin(a0(t))

a1(t) = omg1*t + ang1
x1(t) = cx1 + R1 * cos(a1(t))
y1(t) = cy1 + R1 * sin(a1(t))

where t is time in [sec], cx?,cy? is the center of rotation ang? is starting angle (t=0) in [rad] and omg? is angular speed in [rad/sec]. If the objects have radius r? then collision occurs when the distance is <= r0+r1

so You want to find smallest time where:

(x1-x0)^2 + (y1-y0)^2 <= (r0+r1)^2

This will most likely lead to transcendent equation so you need numeric approach to solve this. For stuff like this I usually use Approximation search so to solve this do:

  1. loop t from 0 to some reasonable time limit

    The collision will happen with constant frequency and the time between collisions will be divisible by periods of both motions so I would test up to lcm(2*PI/omg0,2*PI/omg1) time limit where lcm is least common multiple

    Do not loop t through all possible times with brute force but use heuristic (like the approx search linked above) beware initial time step must be reasonable I would try dt = min(0.2*PI/omg0,0.2*PI/omg1) so you have at least 10 points along circle

  2. solve t so the distance between objects is minimal

    This however will find the time when the objects collide fully so their centers merge. So you need to substract some constant time (or search it again) that will get you to the start of collision. This time you can use even binary search as the distance will be monotonic.

  3. next collision will appear after lcm(2*PI/omg0,2*PI/omg1)

    so if you found first collision time tc0 then

    tc(i) = tc0 + i*lcm(2*PI/omg0,2*PI/omg1)
    i = 0,1,2,3,...
    
Spektre
  • 49,595
  • 11
  • 110
  • 380
  • Thanks for your detailed answer, i was already using similar approach but using brute force instead of approximation search. That's why i was looking for a way to optimize my way to find the first collision (```tc0```) but it seems like transcendent equation are too much for me. Thanks again for the precious time you spent to help me :) – despe Jul 13 '21 at 13:47