Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / 2D Line Intersection

Author
Message
Shed
13
Years of Service
User Offline
Joined: 6th Feb 2011
Location:
Posted: 6th Feb 2011 20:19
I searched the forums over and over and have had to resort to this:

How do I detect an intersection efficiently between two lines.

I intend to generalise it to check for collisions between four arrays, describing two sets of lines.



I would love to hear from you guys, as I have been trying to get this to anything except do it by assigning colours, checking the colour of the pixel, and then checking for every pixel on the screen.

xxx
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 7th Feb 2011 11:23 Edited at: 7th Feb 2011 11:24
If it's just checking whether or not they intersect, then this might do the trick:



I wrote it long ago though. I'm not sure how well it works... If you wish to find the intersection point, then you have to parametrize the line, like in these codes:

http://forum.thegamecreators.com/?m=forum_view&t=99986&b=6

Cheers!
Sven B

Login to post a reply

Server time is: 2024-11-23 03:45:43
Your offset time is: 2024-11-23 03:45:43