gp_Pnt point(1.0, 0, 0); // 创建一个表示旋转的四元数对象 gp_Quaternion quaternion; gp_Vec theAxis{0, 0.0, 1}; // point绕则Z轴旋转45度 quaternion.SetVectorAndAngle(theAxis, 45 * M_PI / 180); gp_Trsf transformation; transformation.SetRotation(quaternion); point.Transform(transformation); // 打印旋转后的点坐标 std::cout << "Rotated Point: (" << point.X() << ", " << point.Y() << ", " << point.Z() << ")" << std::endl; //绕着某个点,某个方向旋转 gp_Pnt point2(1.0, 0, 0); gp_Trsf transformationVec; //绕着点gp_Pnt(0.0, 0.0, 0.0),Z轴方向旋转 transformationVec.SetRotation(gp_Ax1(gp_Pnt(0.0, 0.0, 0.0), gp_Dir(0, 0.0, 1.0)), 45 * M_PI / 180); // Rotate by 30 degrees (π/6 radians) around the X-axis point2.Transform(transformationVec); // 打印旋转后的点坐标 std::cout << "Rotated Point: (" << point2.X() << ", " << point2.Y() << ", " << point2.Z() << ")" << std::endl;
05-25
1337

04-25
1356
