# Parametric Line Intersection in 2D

This topic is 4199 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

If you have two parametric 2D lines equations of the form: r_1(t_1) = p_1 + t_1 d_1 r_2(t_2) = p_2 + t_2 d_2 In 3d you can equate the two equations and eventually simplify to solve for t_1:
      ((p_2 - p_1) X d_2) . (d_1 X d_2)
t_1 = _________________________________
|| d_1 X d_2 ||^2


The problem is that cross product isn't defined in 2D, so what can I do to find for which t the two lines intersect?

##### Share on other sites
The only time I've ever encountered a need for the cross product in 2D was in calculating torque. In that instance I just assumed all the Z's were 0 so the cross product was actually just the z component scalar(the other components multiplied by z to become 0). This might work in your instance as well. Alternativly, you could convert to a non-parametric form of the equations, find the point of collission in the usual way, and then use that point of collission to find the time. In either case, make sure you don't forget the special cases :)

##### Share on other sites
This is a simple case of simultaneous equation solving. Split each equation into its x and y components so you end up with:

r_1x = p_1x + t_1*d_1x
r_1y = p_1y + t_1*d_1y

r_2x = p_2x + t_2*d_2x
r_2y = p_2y + t_2*d_2y

You know at the intersection point that r_1x = r_2x and also that r_1y = r_2y so you end up with:

t_1 = (p_2x - p_1x + t_2*d_2x) / d_1x
t_2 = (p_1y - p_2y + t_1*d_1y) / d_2y

sub one equation into the other and solve, then use the result to solve for the other unknown.

##### Share on other sites

This topic is 4199 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628682
• Total Posts
2984206

• 13
• 13
• 9
• 10
• 10