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?

Thanks,

Raoul

I found this piece of code: http://www.angelfire.com/fl/houseofbartlett/solutions/line2tri.html#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.

]]>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?

]]>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?

Thanks,

Raoul