I am looking to find some code either in C or Objective-C that will allow me to determine (true or false) whether a line intersects with a triangle in 3D.

I've looked at some different graphics libraries, but none of these make the handling of this problem easy to decipher and I'm wondering if someone could provide a clear layout...

I found a C++ version at:

http://geometryalgorithms.com/Archiv...rithm_0105.htm

I'd particularly like to be able to operate with a single function

3DTriangle_Point1_Coordinates = x, y, z

3DTriangle_Point2_Coordinates = x, y, z

3DTriangle_Point3_Coordinates = x, y, z

3DLineSeg1_Point1_Coordinates = x, y, z

3DLineSeg1_Point1_Coordinates = x, y, z

Does_Intersect: 3DTriangle1 AND 3DLineSeg1 ?

if yes: ... on vertex, on edge, etc ?

if no: ...

thanks so much!