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.

DarkBASIC Professional Discussion / Triangle Line Intersection

Author
Message
Caleb7
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location:
Posted: 31st Mar 2010 03:22
I have been slowly figuring out the math behind triangle and line intersection. Finally, I have reached a point where I can raytrace a point onto a plane. My problem is that the plane isn't the one I want; It's a parallel plain offset by the second point vector. I'm not all that sure of what I'm doing. Help would be incredibly appreciated!

Here's my code:


Randomnosity is a special influence upon man kind allowing one to think outside the usual bouderies and into a fantastic world created by oneself. Elephants don't cut it
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 31st Mar 2010 10:53
Hi Caleb7,

I don't think I can help with your code (I don't think I can find the time to figure out all abbreviations and find the method you're using). But here's some code that might help that I made a few years ago for a math project.



Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 1st Apr 2010 16:59
Here's how I learned to do it (with help from Sparky):

You start by checking for an intersection between the line and the plane that the triangle lies on, and get the position of the intersection.

Then, imagine the triangle is extruded, so the lines of the triangle are actually planes. Each plane has an 'above' and a 'below'. If the point is 'below' all three planes, the line intersects the triangle.

"everyone forgets a semi-colon sometimes." - Phaelax
gwheycs62egydws
16
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 16th Apr 2010 19:56
my DBP dose accept

D3D_init

D3D_line3D ax#, ay#, az#, bx#, by#, bz#

D3D_line3D GetIntersectionX(), GetIntersectionY(), GetIntersectionZ(), GetIntersectionX() + GetIntersectionNormalX(), GetIntersectionY() + GetIntersectionNormalY(), GetIntersectionZ() + GetIntersectionNormalZ(), rgb(0, 255, 0), rgb(0, 255, 0)

is there a fix to make this command work ?

Login to post a reply

Server time is: 2026-07-26 21:12:17
Your offset time is: 2026-07-26 21:12:17