triangle intersection

I'm new to OpenCascade and I'm currently facing this problem: finding the intersection between two triangles in general position (they can also be coplanar).
Is there an algorithm in OpenCascade that could compute this intersection? I need the vertices of the segment (or polygon, if the triangles are coplanar).

Simone Chinellato's picture

Hi Giulio,
You can use the functions Intf and Intf_SectionLine (Describe a polyline of intersection between two
polyhedra as a sequence of points of intersection): in your case you provide two triangles and you get 0 points (no intersections) or 2 points (a segment) as the number of points resulting from the computation.

I didn't try it because I enjoy finding out the mathematical solution (find the planes, check if coplanar, check if the line of intersection of the two planes falls inside both triangles...).