+static GeomShapePtr transformShape(const GeomShapePtr theShape, const gp_Trsf& theTrsf)
+{
+ GeomShapePtr aResult(new GeomAPI_Shape);
+ if (theTrsf.ScaleFactor() > 0) {
+ // just update the location of the shape in case of affine transformation
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ if (!aShape.IsNull()) {
+#if OCC_VERSION_LARGE < 0x07070000
+ aShape.Move(theTrsf);
+#else
+ aShape.Move(theTrsf, Standard_False);
+#endif
+ aResult->setImpl(new TopoDS_Shape(aShape));
+ }
+ }
+ else {
+ // all other transformations will modify the shape
+ GeomTrsfPtr aTrsf = std::make_shared<GeomAPI_Trsf>(new gp_Trsf(theTrsf));
+ GeomAlgoAPI_Transform aTransform(theShape, aTrsf);
+ aResult = aTransform.shape();
+ }
+ return aResult;
+}
+