Point of Intersection Between Two Lines

I have two gp_Lin elements (lin1 and lin2), and I know that they intersect in 3D space (the value of lin1.distance(lin2) is 0). Is there a function I can use to find the point at which they intersect instead of coding it all by hand (I could not find one)?

 

Thanks for any help!

Roy

Rob Bachrach's picture

Hi Roy,

It is always a challenge to find the intersection of 3d lines/curves, because of computational error.  You might be better served using something like GeomAPI_ExtremaCurveCurve to find the closest point.  You can then compare the distance to make sure it is within some tolerance of 0.  Then, simply take the extrema point from one of the curves.

Rob

Roy Spades's picture

Yes, the solution you proposed seemed to work quite well. Thanks a lot!

Roy