博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
opencascade中的几种类型转换
阅读量:4071 次
发布时间:2019-05-25

本文共 2625 字,大约阅读时间需要 8 分钟。

1. 将Geom_BSplineSurface转化成TopoDS_Face:

Handle_Geom_BSplineSurface BSurface;
BRep_Builder builder;TopoDS_Face Face;builder.MakeFace(Face,BSurface,Tolerance);

2.将TopoDS_Face 转化为Geom_Surface

Handle_Geom_Surface  currentSur;TopExp_Explorer Ex; Ex.Init(shape,TopAbs_FACE); TopoDS_Face currentVt = TopoDS::Face(Ex.Current());currentSur = BRep_Tool::Surface(currentVt);

3.普通曲线转化为NURBS曲线

Handle(Geom_Curve) ResCurve ;

Handle(Geom_TrimmedCurve) myTrimmed = new Geom_TrimmedCurve(ResCurve, 0, 1);
NurbsCurve = GeomConvert::CurveToBSplineCurve(myTrimmed); //必须指定曲线的类型如Geom_TrimmedCurve

OCC的说明如下:

 

-- Purpose : This function converts a non infinite curve from

-- Geom into a B-spline curve.C must be an ellipse or a

-- circle or a trimmed conic or a trimmed line or a Bezier

-- curve or a trimmed Bezier curve or a BSpline curve or a

-- trimmed BSpline curve or an OffsetCurve. The returned B-spline is

-- not periodic except if C is a Circle or an Ellipse.

 

4. Geom_Surface 转 Geom_BsplineSurface

GeomConvert::SurfaceToBSplineSurface(surface)

其中surface必须为Geom_Surface 中的某一具体类型

OCC的说明如下:

--- Purpose : This algorithm converts a non infinite surface from Geom

-- into a B-spline surface.

-- S must be a trimmed plane or a trimmed cylinder or a trimmed cone

-- or a trimmed sphere or a trimmed torus or a sphere or a torus or

-- a Bezier surface of a trimmed Bezier surface or a trimmed swept

--surface with a corresponding basis curve which can be turned into

-- a B-spline curve

5.  点云转 Geom_BsplineSurface

 

Handle_Geom_BSplineSurface CMiniCADTool::BuildSurface(const TColgp_SequenceOfXYZ& seqOfXYZ){	// Build the surface:	// points are projected on plane z = 0	// the projection vector for each point is computed 	// These data give the input constraints loaded into plate algorithm	const Standard_Integer nbPnt = seqOfXYZ.Length();	Standard_Integer i;	//Filling plate	Plate_Plate myPlate;	for (i=1; i<= nbPnt; i += 4) {		gp_Vec aVec(0., 0., seqOfXYZ.Value(i).Z());		gp_XY  pntXY(seqOfXYZ.Value(i).X(),seqOfXYZ.Value(i).Y());		Plate_PinpointConstraint PCst( pntXY,aVec.XYZ() );		myPlate.Load(PCst); // Load a pinpoint constraint	}	myPlate.SolveTI(2, 1.); // Solving plate equations	if (!myPlate.IsDone()) {		return Handle(Geom_BSplineSurface)();	}	// Computation of plate surface	gp_Pnt Or(0,0,0.);	gp_Dir Norm(0., 0., 1.);	Handle(Geom_Plane) myPlane = new Geom_Plane(Or, Norm);// Plane of normal Oz	Handle(GeomPlate_Surface) myPlateSurf = new GeomPlate_Surface(myPlane, myPlate);//plate surface	GeomPlate_MakeApprox aMKS(myPlateSurf, Precision::Approximation(), 4, 7, 0.001, 0);//bspline surface	return aMKS.Surface();}

 

 

 

to be continue......

 

 

 

转载地址:http://hoeji.baihongyu.com/

你可能感兴趣的文章
Redis持久化存储(AOF与RDB两种模式)
查看>>
memcached工作原理与优化建议
查看>>
Redis与Memcached的区别
查看>>
redis sharding方案
查看>>
程序员最核心的竞争力是什么?
查看>>
Node.js机制及原理理解初步
查看>>
linux CPU个数查看
查看>>
分布式应用开发相关的面试题收集
查看>>
简单理解Socket及TCP/IP、Http、Socket的区别
查看>>
利用HTTP Cache来优化网站
查看>>
利用负载均衡优化和加速HTTP应用
查看>>
消息队列设计精要
查看>>
分布式缓存负载均衡负载均衡的缓存处理:虚拟节点对一致性hash的改进
查看>>
分布式存储系统设计(1)—— 系统架构
查看>>
MySQL数据库的高可用方案总结
查看>>
常用排序算法总结(一) 比较算法总结
查看>>
SSH原理与运用
查看>>
SIGN UP BEC2
查看>>
S3C2440中对LED驱动电路的理解
查看>>
《天亮了》韩红
查看>>