首页 > 其他分享 >OCC曲线投影到面上

OCC曲线投影到面上

时间:2024-09-12 14:14:04浏览次数:1  
标签:10 wire gp Curve OCC 曲线 投影 Pnt BRepBuilderAPI

 1 TopoDS_Edge edge0 = BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0, 0), gp_Pnt(10, 10, 10));
 2     Geometry::instance()->addShape(ShapeType::Curve, edge0);
 3 
 4     gp_Pnt pnt1(0, 10, 0);
 5     gp_Pnt pnt2(10, 10, 0);
 6     gp_Pnt pnt3(10, 0, 0);
 7     gp_Pnt pnt4(0, 0, 0);
 8     TopoDS_Edge edge1 = BRepBuilderAPI_MakeEdge(pnt1, pnt2);
 9     Geometry::instance()->addShape(ShapeType::Curve, edge1);
10     TopoDS_Edge edge2 = BRepBuilderAPI_MakeEdge(pnt2, pnt3);
11     Geometry::instance()->addShape(ShapeType::Curve, edge2);
12     TopoDS_Edge edge3 = BRepBuilderAPI_MakeEdge(pnt3, pnt4);
13     Geometry::instance()->addShape(ShapeType::Curve, edge3);
14     TopoDS_Edge edge4 = BRepBuilderAPI_MakeEdge(pnt4, pnt1);
15     Geometry::instance()->addShape(ShapeType::Curve, edge4);
16 
17     BRepBuilderAPI_MakeWire wire;
18     wire.Add(edge1);
19     wire.Add(edge2);
20     wire.Add(edge3);
21     wire.Add(edge4);
22     wire.Build();
23 
24     BRepBuilderAPI_MakeFace face(wire);
25     Geometry::instance()->addShape(ShapeType::Surface, face);
26 
27     Standard_Real first, last;
28     Handle(Geom_Curve) curve = BRep_Tool::Curve(edge0, first, last);
29     Handle(Geom_TrimmedCurve) trimmedCurve = new  Geom_TrimmedCurve(curve, first, last);
30 
31     Handle(Geom_Surface) surface = BRep_Tool::Surface(face);
32 
33     Handle(Geom_Curve) projCurve = GeomProjLib::Project(trimmedCurve, surface);
34 
35 
36 
37     /** 计算端点投影 */
38             /*@{*/
39     gp_Pnt pntFirst(0, 0, 0);
40     gp_Pnt pntLast(10, 10, 10);
41 
42     GeomAPI_ProjectPointOnSurf projFirst(pntFirst, surface);
43     GeomAPI_ProjectPointOnSurf projLast(pntLast, surface);
44 
45     if (projFirst.NbPoints() != 1 || projLast.NbPoints() != 1 || projFirst.Point(1).Distance(projLast.Point(1)) < Precision::Confusion()) {
46         return;
47     }
48     pntFirst = projFirst.Point(1);
49     pntLast = projLast.Point(1);
50 
51     Standard_Real newFirst, newLast;
52     if (
53         !GeomLib_Tool::Parameter(projCurve, pntFirst, Precision::Confusion(), newFirst) ||
54         !GeomLib_Tool::Parameter(projCurve, pntLast, Precision::Confusion(), newLast)) {
55         return;
56     }
57     /*@}*/
58 
59     BRepBuilderAPI_MakeEdge result(projCurve);
60 
61     Geometry::instance()->addShape(ShapeType::Curve, result);

 

标签:10,wire,gp,Curve,OCC,曲线,投影,Pnt,BRepBuilderAPI
From: https://www.cnblogs.com/chanyuantiandao/p/18410085

相关文章

  • 利用投影技术增强RAG文档检索的多样性
    介绍检索增强生成(RAG)已成为语言模型中生成更准确和上下文相关输出的流行方法。通常,RAG中的检索步骤依赖于余弦相似度来识别top-n相关文档。然而,这种方法的一个缺点是它可以返回高度相似的文档,从而导致冗余和较少的响应多样性。这里提出了一种通过迭代调整所选文档向量来......
  • C# process =An error occurred trying to start process with working directory The
    usingSystem.Diagnostics;//Seehttps://aka.ms/new-console-templateformoreinformationConsole.WriteLine("Hello,World!");stringpath=@"..\..\..\Image";stringfullPath=System.IO.Path.GetFullPath(path);varimgsList=System......
  • OpenGL ES使用正交投影来解决图像变形的问题
    一、概述上一节实践了,通过改变GLSurfaceView的宽高来解决图像变形的问题。本节将通过正交投影的方式解决图像变形的问题。分三步:1.计算屏幕的宽高比及图像的宽高比varscreenRatio=screenWidth.toFloat()/screenHeightvarimgRat......
  • Centos7 故障排除_a tpm error occurred get tpm pcr allocation
    误操作/实验故意破坏系统重要文件,如何修复系统;系统起来不时使用光盘引导,启动系统故障排除模式1)光盘引导系统启动2)选择故障排除3)救援系统4)5)6)注意:此模式下原本系统的根下的目录均被挂载至/mnt/sysimage/目录下示例1:删除许多命令依赖的共享库文件ldd-可查......
  • SFI-HBase一种基于二分空间填充曲线的HBase多维索引(小论文)
    SFI-HBase:一种基于二分混合空间填充曲线的HBase多维索引摘要HBase是一款流行的开源分布式数据库,能够支持海量数据的实时读写。然而,HBase并没有提供对多维索引的支持。针对这一问题,本文从线性化方法入手,使用Z曲线等支持二分划分的空间填充曲线混合理论性质优良的其他空间......
  • 基于二分混合空间曲线的HBase多维索引构建及查询优化问题研究
    目录1绪论11.1研究背景与意义11.2国内外研究现状21.2.1索引技术21.2.2空间填充曲线51.3论文主要工作61.4论文章节安排72相关理论基础与技术简介82.1大数据存储与计算技术82.1.1Hadoop生态圈82.1.2HDFS82.1.3HBase92.1.4SparkStreami......
  • 2.3 在同一个图形界面中分别画出6条曲线 y=kx^2+2k k=1,2,3...
    点击查看代码importnumpyasnpimportmatplotlib.pyplotasplt#定义x的范围x=np.linspace(-10,10,400)#创建一个图形和坐标轴plt.figure(figsize=(10,6))ax=plt.gca()#循环绘制每条曲线colors=['r','g','b','c......
  • Goolge earth studio 高阶3——自定义缓动曲线
    EarthStudio还提供了更高级的选项,比如“自定义”缓动曲线。自定义曲线允许你手动调整曲线,以获得所需的确切时间和流畅度。1、单击我们还要修改的属性,就能在时间框中看到一个表示变化速度的图形编辑器,黄色曲线就是随时间变化的设置值。黄色曲线上的圆圈为关键帧的值,可以拖动......
  • [open3d]点云投影2D图像
    输入:三维点云输出:2DDSMimportopen3daso3dimportnumpyasnpimportcv2#读取点云,转换为栅格图像#将栅格图像分块resolution=0.2save_path=r"dsm.png"print("->正在加载点云...")m_pc=o3d.io.read_point_cloud("WHU.ply")print(m_pc)print('......
  • MyPrint打印设计器(七)svg篇-二阶贝塞尔曲线
    svg-二阶贝塞尔曲线介绍一款强大的svg操作库,能够通过简单的代码,实现svg绘制与操纵,实现拖拽等功能代码仓库在线体验代码仓库:github代码仓库:gitee实战项目:MyPrint操作简单,组件丰富的一站式打印解决方案打印设计器体验地址:前往代码仓库:github代码仓库:gitee本文......