Sign in to follow this  
Uthman

Collision between two lines

Recommended Posts

Use 3d rays.
For 2 rays defined parametrically as O+t*D = P, where O is the origin, D is a direction, and t is a distance or time along the direction from the origin.
The intersection of the 2 rays is:
t1 = (((o2-o1) x d2) . (d1 x d2)) / (magnitude (d1 x d2))^2
where . is the dot product of 2 vectors, and x is the cross product. ^2 means squared.
Hope this was helpful!

[edit]
BTW: if the 2 rays don't intersect, the t return will yield the closest point on the one ray to the other.
[/edit]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this