BRepTools::OuterWire returns wrong wire

Hello,

I have a face including four holes from which I need the outer wire but BRepTools::OuterWire returns the wire of one of the holes as outer wire. The face seems sound to me. Is there anything I can do so it return the correct wire or is it a bug?

Tested with 7.6.1 and 7.8.0

Kind regards, Dirk

Attachments: 
Thomas Anderson's picture

I can confirm your bug here on debian bookworm occt 7.8.0. I traced the problem to BndLib_Box2dCurve::PerformBSpline where is just blatantly adds poles to the bounding box. This reminded of a post that Roman had done years ago. Romans work around doesn't seem to help you as the presence of triangulation doesn't seem to affect the 2d bounding box calculation. I would assume Roman is correct in speculating that this kind of 'just use the poles, hack' is for performance and any changes to a 'minimum bounding box' would slow things down.

Looking at BRepTools::OuterWire: It assigns the first wire and then iterates over the rest of the wires requiring larger boundaries in all directions. So in your case, the first wire is one of the circles that has an inflated v range. The rectangular wires v boundaries are inside of that first circular wire, causing the algo to fail. I think this algo could at least have a smarter first guess using the diagonal of the 2d bounding boxes, without much performance impact, but there would still be cases that will fail as long as the spline bounds are 'inflated'.

Arjan Schouten's picture

Thanks for looking into this Thomas and confirming it's a bug.

If anyone from the OCC team wants to report this in the bug tracker and use the file for testing then that's ok with me.

Dirk

Dmitrii Pasukhin's picture

Hi, We will create a new issue, but the solution will include some rework of logic. I'm not sure that it will be include into nearest releases.

0033632: Modeling Algorithms - BRepTools::OuterWire returns internal wire - MantisBT (opencascade.org)

Best regards, Dmitrii.