S
Superfluous_Nut
Guest
Okay, lessee if mathmajor is worth his salt...
I'm interested in finding the smallest value of 't' where two moving line segments intersect. (t being time)
the two lines connect are (x1(t),y1(t))-(x2(t),y2(t)) and (a1(t),b1(t))-(a2(t),b2(t))
x1(t) = x1.previous * (1-t) + x1.current * t
y1(t) = y1.previous * (1-t) + y1.current * t
x2(t) = ...
etc
da(t) = a2(t)-a1(t)
db(t) = b2(t)-b1(t)
dx(t) = x2(t)-x1(t)
dy(t) = y2(t)-y1(t)
u = (da(t)*(b1(t)-y1(t)) - db(t)*(a1(t)-x1(t)))
. ------------------------------------------
. dy(t)*da(t) - db(t)*dx(t)
u = intersection point along (x1,y1)-(x2,y2) line. u<0 means it's off the segment, as does u>1.
Anybody have any suggestions?
I'm interested in finding the smallest value of 't' where two moving line segments intersect. (t being time)
the two lines connect are (x1(t),y1(t))-(x2(t),y2(t)) and (a1(t),b1(t))-(a2(t),b2(t))
x1(t) = x1.previous * (1-t) + x1.current * t
y1(t) = y1.previous * (1-t) + y1.current * t
x2(t) = ...
etc
da(t) = a2(t)-a1(t)
db(t) = b2(t)-b1(t)
dx(t) = x2(t)-x1(t)
dy(t) = y2(t)-y1(t)
u = (da(t)*(b1(t)-y1(t)) - db(t)*(a1(t)-x1(t)))
. ------------------------------------------
. dy(t)*da(t) - db(t)*dx(t)
u = intersection point along (x1,y1)-(x2,y2) line. u<0 means it's off the segment, as does u>1.
Anybody have any suggestions?