Segment - Tri intersection?

Started by
0 comments, last by haegarr 15 years, 6 months ago
I've been trying to put together a general line-of-sight (or raycasting, take your pick) routine for a little bit, but i'm amazed to find so little information on how to do it, especially since this stuff has been around for ages... In short, what i'm trying to do is find if one point in world space can see another, and if any tris are blocking them; and what i'm doing now isn't working. I don't need field of view or anything, just if one could draw a line directly from point A to B without any tris in the way. Help's appreciated.
Advertisement
A line segment is just the track of a ray between 2 distances. E.g., if the segment is spanned from point A to point B, then
d := B - A
R(k) := A + k * d for 0 <= k <= 1
defines the segment on the ray R. You can also set d to unit length and run k up to |d| (before normalization, of course) if you want.

With this in mind, google for "ray triangle intersection" for the math. (And consider to use bounding volumes or some other stuff to speed up testing if you run into a bottleneck when using plain triangle tests only.)

This topic is closed to new replies.

Advertisement