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.

Code Snippets / [DBPro] 2D Line-Intersection (again...)

Author
Message
Mr Kohlenstoff
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 14th Jun 2007 19:41
I've also made a small 2D line-intersection, I think nearly everyone has already made one and posted it here.. anyway. ^^

I've commented the code, and I think it's easy to understand what I've done in the function.
The function returns, if the lines collide, and two other functions can return the coordinates then.

The code includes an example:



Maybe someone knows if it can be improved anywhere.. but I think with 0.0004 ms/calculation on my lower-average-computer it's fast enough to use it in realtime applications for 2D Sprite-Collisions etc..
Have fun with it.

Visit the DBPro - Speed up your game-Thread. http://forum.thegamecreators.com/?m=forum_view&t=88661&b=1

Login to post a reply

Server time is: 2024-11-22 18:38:33
Your offset time is: 2024-11-22 18:38:33