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.

AppGameKit Classic Chat / [SOLVED] Line line intersection

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Mar 2019 08:00 Edited at: 25th Mar 2019 08:01
I found some code for it here. Thank you Mr B

I implemented it in the attached project and it works perfectly. Except for that one situation where the lines intersect at right angles.


I'm not sure what i've got wrong here, or if it's just a situation the code doesn't handle.
Anyone have any idea how i can fix it?
Thanks in advance for your help

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Mar 2019 21:34 Edited at: 25th Mar 2019 23:28
This post has been marked by the post author as the answer.
So i check of the from/to x/y values are equal and add a small amount to one if they are



This generally goes hand in hand so here is some code to scale a line up or down

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Mar 2019 00:11
I know you already have a solution, but thought I'd share my list of intersection equations:

https://www.zimnox.com/resources/articles/math/?ar=m002#5
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 26th Mar 2019 08:02
Excellent! Thanks

Login to post a reply

Server time is: 2024-04-28 02:21:57
Your offset time is: 2024-04-28 02:21:57