collision detection between moving lines

Started by
11 comments, last by keethrus 21 years, 4 months ago
i wonder if what Bobby-D said would work?

make all the movement (translation) and rotation relative to just one of the lines - so one line would be stationary and the other would move/rotate around it. then, you would test a 4-sided polygon against a line - which i dont imagine would cause a problem. or would you not want to make a 4-sided polygon and instead test for collision another way? i could definately see this as a good potential DID/DIDNT collision test between two lines. how would you go about setting up the formulas to test for the TIME they collided though?

- jeremiah

inlovewithGod.com
Advertisement
The best way to find this in time is to parameterize your line.

x = x0 + xd*t
y = y0 + yd*t

Where x0 and y0 are the points on the line when time is 0, and xd and yd are equal to dx/dt and dy/dt respectively. Some higher math really helps here but the concept isn''t that hard.

Basically express both lines in terms of t, then put each one on a "side" of an equation and solve for when the sides are equal. If they are never equal, you never intersect at the same time. If they are, the time when they do (t) is right there in the solution.


Of course you can''t get from that to visualization very easily, and to use rotation/motion you''ll have to add a bit to the x and y equations I listed above. Still, not that difficult, just very time consuming to derive the equations.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

I worked on this for 3 days and I think I have *a* solution. Gotta say I''m disappointed in what I''ve found. Here''s what I found:

http://www.geocities.com/steelgolem9/line_int.htm

Thanks for the great info above though, I''m going to use some of it in my new method ^_^

SteelGolem

This topic is closed to new replies.

Advertisement