Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -




Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno

Go back

Topic review (newest first)

2006-02-14 23:46:19

I started this thread a while ago and thought I found the answer, I guess not as it doesn't work.

Anyone knows a fast way to test if a vertical line intersects the triangle formed by 3 points and if so, find the intersection point?


2006-01-28 21:00:10

Sorry, This is a line / triangle intersection in a 3D world (directx). Actually what I need to find out is the y position of a landscape at a given position for x and z. so I can place an object on the landscape. A landscape is simply a huge number of vertices. 3 vertices connected to eachother (triangle) form a face. So my thought was, if I make a vertical line with known x and z values and a low and high y value I should be able to find the y value of the landscape at intersection point.

I found this piece of code:

But actually this is a bit more complex. I only have access to vertice positions. If I first search for the 3 vertices of which the x and z values are closest to the x and z values of the line and if I then check whether the line is inside the triangle formed by these 3 vertices, will it be certain that these 3 triangles do actualy form a face? I think not. I guess I will have to experiment with this and see how accurate it is in bumpy areas of the landscape.

2006-01-28 12:42:24

What is your equation for the line?  Parametric?

What is your equation for the triangle?  Vectors?

Which vertices of the triangle do you wish to find?  There are two where the line intersects the side of the triangle.  Both?

The line also intersect both sides of the triangle, unless it is tangent to a vertice.  Is this what you mean?

2006-01-28 11:05:46


I found out how to check if a line intersects with a triangle but actually it turns out that, in the case of "yes", I also need the intersection point.

Does someone have a quick way to find this vertice?


Board footer

Powered by FluxBB