使用OCC进行几何旋转变换
#include <gp_Ax2.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRep_Builder.hxx>
//几何旋转需要基于一个轴
//gp_Ax1描述了三维空间中的一个轴
//这里以原点指向y轴正方向为例子
//定义轴的起点
gp_Pnt oriPoint(0, 0, 0);
//定义方向
gp_Dir dir(0, 1, 0);
//定义旋转轴
gp_Ax1 ax(oriPoint,dir );
//定义一个变换
gp_Trsf trsf;
//设置旋转轴和旋转角度,这里以90°为例
trsf.SetRotation(ax, 90 * PI / 180);
//执行旋转变换
//获取要操作的shape
TopoDS_Shape shape = getShape();
BRepBuilderAPI_Transform aBRespTrsf(shape, trsf, true);
aBRespTrsf.Build();
TopoDS_Shape resShape = aBRespTrsf.Shape()