当前位置: 首页 > article >正文

Open CASCADE学习|拓扑变换

目录

平移变换

旋转变换

组合变换

通用变换


平移变换

TopoDS_Shape out;gp_Trsf theTransformation;gp_Vec theVectorOfTranslation(0., 0.125 / 2, 0.);theTransformation.SetTranslation(theVectorOfTranslation);BRepBuilderAPI_Transform myBRepTransformation(out, theTransformation);TopoDS_Shape TransformedShape = myBRepTransformation.Shape();

旋转变换

TopoDS_Shape out;gp_Trsf theTransformation;gp_Ax1 axez = gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0., 0., 1.));theTransformation.SetRotation(axez, -90 * M_PI / 180);BRepBuilderAPI_Transform myBRepTransformation(out, theTransformation);TopoDS_Shape TransformedShape = myBRepTransformation.Shape();

组合变换

TopoDS_Shape out;
//平移:
gp_Trsf theTransformation1;
gp_Vec theVectorOfTranslation(0., 0.125 / 2, 0.);
theTransformation1.SetTranslation(theVectorOfTranslation);
//绕一个轴旋转:
gp_Trsf theTransformation2;
gp_Ax1 axez = gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0., 0., 1.));
theTransformation2.SetRotation(axez, -90 * M_PI / 180);
​
gp_Trsf theTransformation3;
gp_Ax1 axex = gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(1., 0., 0.));
theTransformation3.SetRotation(axex, -50 * M_PI / 180);
​
BRepBuilderAPI_Transform myBRepTransformation(out, theTransformation3*theTransformation2* theTransformation1);
TopoDS_Shape TransformedShape = myBRepTransformation.Shape();

通用变换

TopoDS_Shape S;
Handle(gp_GTrsf) theTransformation = new gp_GTrsf();
Handle(gp_Mat) rot = new gp_Mat(1, 0, 0, 0, 0.5, 0, 0, 0, 1.5);  //描述一个三行三列的矩阵,用以替换转换的矢量部分
theTransformation->SetVectorialPart(*rot);
theTransformation->SetTranslationPart(gp_XYZ(5, 5, 5)); //使用一个给定的坐标系作为转换,即替换原图形的局部坐标系
Handle(BRepBuilderAPI_GTransform) myBRepTransformation = new BRepBuilderAPI_GTransform(S, theTransformation, false);
TopoDS_Shape S2 = myBRepTransformation->Shape(); //改变形状以及位置后的拓扑


http://www.kler.cn/a/227182.html

相关文章:

  • vit细粒度图像分类(九)RAMS-Trans学习笔记
  • ChatGPT高效提问—基础知识(NLP)
  • 政安晨:示例演绎Python的函数与获取帮助的方法
  • vscode无法ssh远程连接到服务器:远程主机可能不符合 glibc 和 libstdc++ VS Code 服务器的先决条件
  • 01神经网络的理论及实现
  • 【开源】SpringBoot框架开发大学计算机课程管理平台
  • LeetCode第 123 场双周赛个人题解
  • 网络原理-TCP/IP(5)
  • Matplotlib箱形图的绘制与高级技巧解析【第57篇—python:Matplotlib箱形图】
  • 成都爱尔周进解析半飞秒手术--充满多样性的屈光手术方式
  • docker elasticsearch8启动失败
  • 初始mach-o文件及在项目中应用
  • Web实战丨基于django+hitcount的网页计数器
  • 编程笔记 html5cssjs 077 Javascript 关键字
  • ICA:独立成分分析
  • springboot jar包编写启动start.sh
  • Mac Shift切换输入法 - shift切换中英文 - Karabiner-Elements
  • [Angular 基础] - Angular 渲染过程 组件的创建
  • Pycharm 关闭/退出烦人的Pytest模式
  • Java Socket Server TCP服务端向指定客户端发送消息