# Thread: Measuring frequency of line segment intersection with triangles

1. ## Measuring frequency of line segment intersection with triangles

I have a data set of 3D line segments centered at the origin, and a “sphere” with a surface made up of really small triangles, and need to write a program to measure the frequency of intersections of these line segments with the different triangles (the line segments always intersect with the sphere somewhere; the problem is figuring out where). I'm new to programming and am starting with C, so if anyone could give some idea of how to start, it'd be very much appreciated.

2. Wow, this is the kind of question that inspires me to learn something new. I don't know how to do it, but I recall implementing a 2 space version form Robert Sedgewick's algorithm book. The idea was to see if a point in 2 space is in or out of a polygon and involved extending a horizontal line on the point to determine if it intersected a line in the polygon. For your problem, I suppose you need to determine the equation of each line, and the equation of each triangle and solve for an intersection. You'd have to narrow down the number of candidate triangles somehow or performance would really suffer.

3. comp.graphics.algorithms Frequently Asked Questions
5.05: How do I find the intersection of a line and a plane?

But since the lines start at the origin, just calculate the 3D angle, and calculate directly which surface triangle it would intersect.

4. A good place to start is getting your verticies into memory, if they're not there already. If they are in a file, is it a binary file, ascii file, xml ?

Popular pages Recent additions