Open CASCADE基础介绍(4)

Open CASCADE基础介绍(4

gp_Trsf

定义一个矩阵变换的类

--可以定义平移、旋转、缩放的矩阵;

--可以对称于一个点,一条线,一个平面;

示例一:

对称于一个点:

gp_Trsf theTransformation;

gp_Pnt PntCenterOfTheTransformation(110,60,60);

theTransformation.SetMirror(PntCenterOfTheTransformation);

 

示例二

绕一个轴旋转

gp_Trsf theTransformation;

gp_Ax1 axe = gp_Ax1(gp_Pnt(200,60,60),gp_Dir(0.,1.,0.));

theTransformation.SetRotation(axe,30*PI/180);

 

示例三

缩放

gp_Trsf theTransformation;

gp_Pnt theCenterOfScale(200,60,60);

theTransformation.SetScale(theCenterOfScale,0.5);

 

示例四

平移

gp_Trsf theTransformation;

gp_Vec theVectorOfTranslation(-6,-6,6);

theTransformation.SetTranslation(theVectorOfTranslation);

 

示例五:

Displacement

TopoDS_Shape S = BRepPrimAPI_MakeWedge(60.,100.,80.,20.);

gp_Trsf theTransformation;

gp_Ax3 ax3_1(gp_Pnt(0,0,0),gp_Dir(0,0,1));

gp_Ax3 ax3_2(gp_Pnt(60,60,60),gp_Dir(1,1,1));

theTransformation.SetDisplacement(ax3_1,ax3_2);

BRepBuilderAPI_Transform myBRepTransformation(S,theTransformation);

TopoDS_Shape TransformedShape = myBRepTransformation.Shape();

 

示例六:

变形

gp_GTrsf theTransformation;

gp_Mat rot(1, 0, 0, 0, 0.5, 0, 0, 0, 1.5);

theTransformation.SetVectorialPart(rot);

theTransformation.SetTranslationPart(gp_XYZ(5,5,5));

BRepBuilderAPI_GTransform myBRepTransformation(S,theTransformation);

TopoDS_Shape S2 = myBRepTransformation.Shape();

 

BuilderAPI_MakeEdge

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值