BRepBuilderAPI_GTransform makes boolean operations slow.


I was trying to make some boolean operations with simple solids like box. The operation required much more time when the box was transformed with BRepBuilderAPI_GTransform. However, when I used BRepBuilderAPI_Transform the operation was much faster.

For example:

TopoDS_Shape box = BRepPrimAPI_MakeBox( 2, 2, 4 );
TopoDS_Shape cyl = BRepPrimAPI_MakeCylinder( 0.9, 3 );
gp_GTrsf gtr;
gtr.SetTranslationPart( gp_XYZ( -1., -1., 0. ) );
gp_Trsf tr;
tr.SetTranslationPart( gp_Vec( -1., -1., 0. ) );
if ( 1 ) box = BRepBuilderAPI_GTransform( box, gtr );
else box = BRepBuilderAPI_Transform( box, tr );
shapeResult = BRepAlgoAPI_Cut( box, cyl );

I have checked the structure of the box after the transformation and BRepBuilderAPI_GTransform turned the faces of the box into BSpline faces.

My question is: Can I use non-uniform transformation without having the faces turned into BSpline faces? (I would like to reach higher speed and use different x, y, z scale factors.)


Roman Lygin's picture

Hi Tibor,

GTransform keeps the parametric space ranges of curves and surfaces but certainly modifies 3D reps. So in the case of planes and lines (which are parameterized by their lengths) the only way is to convert into BSplines to keep the range. That’s why your box (made of planes and lines) becomes a NURBS-based. Booleans on NURBS is definitively slow than on elementary geoms.


mirjanszky.tibor's picture


And what if I don't insist on keeping the parametrization?
(Does this question make any sense?)