wmayer wrote:So, you actually have to use either TopAbs_IN, _OUT, _ON, _UNKNOWN.
yup.
wmayer wrote:Strange. Even IsPartner() which is less restrictive fails. So, that actually would mean there are two TShapes. But I remember I had recently the same problem but can't remember in which context.
I think this is an OCC bug and we should ignore it for now and revisit it if it causes too many problems in the future.
wmayer wrote:You may also have a look at FeatureSketchBased.cpp from PartDesign module.
I am guessing that for the sketcher you had to have a much broader approach to the boundary analysis than what we need for the face union. The sketcher might have several outer boundaries and may have some inners, where with the face union we have one outer and if there are more boundaries we know they are inner. So, for the face union we should be able to just use the boundary with the largest bounding box for the outer boundaries and the rest are interior boundaries. Then we won't have to build the faces just to test.
back to speed: There are basically three steps(loops) right now to get the faces grouped together that can be replaced. the steps are:
put all the faces together that are the same type: planar cylindrical etc..
put all the faces together that are equal(defined by the typedclass).
put all the faces together that are adjacent.
the first 2 steps could probably be combinded into one without too much trouble and that would eliminate one loop. I think the 3rd step should remain on it's own as it uses recursion and would be a killer if we had to bring that out to a main loop. I think when we get to the adjacent find it would be beneficial to set up some kind of map from the faces to the edges instead of constantly calling getFaceEdges. I am not convinced that I have the recursion right. When I was testing that the edge.isSame problem I saw a bunch more calls to getFaceEdges than I expected. I will have to get my head back into that and it might be a significant bottleneck.
Your time complexity estimate could be spot on, but I think more relevant to the adjacency portion and not the whole operation. I would like to see the time comparison between a meshed cube with 100 faces on each side with a meshed cube that has 595 face on one side and 1 face on the other five sides. With the problem domain I was considering (basic primitive booleans and the resultant faces), I figured that the adjacency algorithm was going to be working with a very small subset of faces. Thinking the type and equality checks would eliminate most of our faces from our working sets. My point is that we should be careful about optimizing to a mesh box as that will probably tell us that the adjacency code is slow were in the real world it could be something else. I am making an assumption that merging faces of a mesh isn't something that we need to do in the real world. Is it?