Intersection of two wires


CAD practitioner
I would like to find possible intersection points between two wires 2D (closed or open, it doesn't matter).
First solution is to compare each edge of first wire with each edge of second wire by using the class GeomAPI_ExtremaCurveCurve.
But, is there another class able to do this work directly, I mean, a class with a costructor that allows only wire1 and wire2 as input?

Thank you


CAD practitioner
I said a 2D wires, but really they are two wires defined in 3D space lying on the same plane. Usually I try to avoid boolean operations because they seems to be not so precise. More, if I rember well, I tried to do this but I didn't obtain good results. I could transform them in faces, but it's possible only for closed wires. More, I could create 2 prisms by extruding the wires in orthogonal direction to the plane, in order to transform them in solid
shapes. So, if some intersctions will be found, they will have the form of straight edges orthogonal to the plane, ... then intersect them with the
plane, etc.. ... Ok, but I would like a more direct way.


Active CAD practitioner
Staff member


I would use your first approach with the curves intersecting each other. Just would try to use Geom2dAPI_InterCurveCurve (more reliable) instead of GeomAPI_ExtremaCurveCurve. Geom2dAPI_InterCurveCurve requires 2dCurves, so you can first change the basis (I think you have a transition matrix) and then zero out one of the coordinates to form a 2dCurve. Then these curves intersect. The coordinates of the intersection points are restored - the transition matrix is known.


CAD practitioner
Thank you, Andrey, for your answer.
But my wish is to avoid to split the two wires into their edges, and compare them each other to detect possible intersections.
I wished there was some OpenCascade class, unknown to me, that perform the task but, no problem.

Thank you again