GeomAPI_ExtremaCurveCurve does not find extremum

Dear OpenCascade community,

although this question has been mentioned a lot of times already, I was not really able to find an answer to that.

Given a section (a Geom_TrimmedCurve whose basis is a line) from (0.25,0,0) to (0.5,0,0) and a circular arc (a Handle_Geom_TrimmedCurve, whose basis is a circle) with the center (0,0,0) and radius 0.5. The arc is trimmed such that its valid range is between the x and y axis. Its "axis" is (0,0,-1)

Clearly, the extremum between these two curves is their intersection -> (0.5,0,0)

The circular arc is created by three points:
p1: (0.5,0,0)
p2: (0,0.5,0)
p3: (0.5*cos(pi/4),0.5*cos(pi/4),0)

The problem is:
If the arc is created such that the parametrization runs from p1->p2, the GeomAPI_ExtremaCurveCurve finds (0.5,0,0) as an extremum. However, if the arc is parametrized the opposite way p2->p1, the algorithm does not find any point.

I really tried to debug into what happens in the algorithm, but somehow Eclipse and GDB fails to find the resource "Extrema_GExtCC.gxx", thus I have no idea what is going inside the extremacomputer.

So the question: is this a bug, or some predetermined behavior?

My second question: What do you people use for computing intersections of curves?

Best regards,

Laszlo Kudela's picture

Alright, after some hacking I could debug into the extrema calculation. I guess the problem is due to the trimmed nature of the curves, because the core algorithm works on gp entities from the TKMath package. But I am not sure, a confirmation from a developer would be nice :)

A possible workaround is to convert the curves to B-Splines using GeomConvert::curveToBSplineCurve() and perform the intersection on these converted curves. I did some testing on this, it finds the intersection, although at some cases the error is in the 1E-8 range.

Does anyone have experience with these things?

Laszlo Kudela's picture

Speaking of the Extrema package, does anyone know how can I set a custom tolerance for the extrema computation? I want to have something in the range of 1E-12, if it is possible, of course.

Alexander Luger's picture

Did you have a look at the class IntTools_EdgeEdge? It allows you to define a tolerance value for two given edges.