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 / inTriangle() Function - Detect if a point is inside a triangle (DBPro)

Author
Message
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 25th Sep 2003 22:38
Just a simple function to see if a specified point is inside a triangle.

Example:


Function:


Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Sep 2003 23:10
Cool, I just wrote a similar function a few weeks ago. Though I didn't use the 3d math commands, and the results were accurate enough for some reason.
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 25th Sep 2003 23:52
Can I see?

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Sep 2003 00:17
I posted my own version into Codebase a few days ago

Mine uses a slightly faster and more compressed method.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Sep 2003 02:23
I quit fussing over it, cause I found UWDesign had the function I needed.
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 26th Sep 2003 19:32 Edited at: 26th Sep 2003 19:35
You did Ian? Oh well, I'll take a look.

EDIT

Ahh, I see, you test to see if the first two dot products are on different sides of 0 and then if not test the third.

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM

Login to post a reply

Server time is: 2024-04-18 07:57:37
Your offset time is: 2024-04-18 07:57:37