Archived

This topic is now archived and is closed to further replies.

yanuart

2D lines intersection

Recommended Posts

For ex. I have 2 lines in 2D, Line1 (x1,y1)-(x2,y2) and Line2(a1,b1)-(a2,b2) how do I know if those two intersect ?? I''m trying to apply this so that I know if for ex. wether a movement will cross a line or not, and I mean crossing and not colliding, let''s say I''m checking wether a person is crossing a police line or not and I''m not saying that a person can''t, but if the person does then the police will be alerted or something like that.. thx..

Share this post


Link to post
Share on other sites
this is still a collision detection problem. just becuase when you detect a collision you are not preventing the object from passing through does not change how you detect it.

do a search for a line intersection formula. check your math book, or the net. this is something that should have been posted in the math and physics forum (because its a math problem). dont post there now, because i have given you the answer you need. google wil give you plenty of information.

Share this post


Link to post
Share on other sites
a person is quite right, this is definately not the forum for this, Math and Physics or For Beginners would be the place to post.

And before you tried posting there you should try looking for the information yourself (asking other people to do your work and you'll never learn anything), using Google and the search terms Line Intersection, the first link it returned was Line-Line Intersection - From MathWorld, which has lots of pretty pictures to make it easy to understand the algorithm. In future try Google, put whatever you want into the little box and see what it gives you. If you're still stuck come here and post to the right forum. You will save alot of time this way.

[edited by - Michalson on May 6, 2002 5:11:52 PM]

Share this post


Link to post
Share on other sites