Login  Register

Re: Intersection of two triangles

Posted by runiter on Aug 14, 2017; 12:18am
URL: https://forum.jogamp.org/Intersection-of-two-triangles-tp4038124p4038126.html

Thanks for the detailed reply Phil.
What I'm trying to do is to find the intersection line/curve between two mesh and draw them.
So I don't need the equation of the line, a series of intersection points will do fine.

The J3D collision behavior, does it detect collision based on bounding boxes or exact geometry? If all it does is use bounding boxes then it's useless to me because my meshes are near each other so their bounds are always in collision.

I think I will use the PickTool as you suggested, the pickSegment in particular. I can convert a triangle mesh into 3 line segments, then use pickSegment to check if at least 2 of those line segments intersect with another mesh. If so, draw a line between those 2 intersection points. It won't be perfect, but probably sufficient.

Now I have to decide if I should use PickTool at all. It might be faster if I implement my own lineSegment+Triangle check code because j3D because PickTool does a whole bunch of extra things that I don't need such as: sub-primitive picked (that is, the point, line, triangle or quad), the closest vertex to the center of the pick shape, and the intersection's normal, color and texture coordinates.

Also PickTool seem to require ALLOW_GEOMETRY_READ, ALLOW_FORMAT_READ, ALLOW_COUNT_READ, and ALLOW_COORDINATE_READ plus the ALLOW_COORDINATE_INDEX_READ. All these would be not necessary in my own implementation since I already have access to coordinates array and I wonder if these capabilities would slow down rendering.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D