三维图形学知识分享---求平面与模型相交线

在CGAL(Computational Geometry Algorithms Library)中,Polygon_mesh_processing模块提供了用于处理多边形网格数据结构的功能。其中,surface_intersection函数是用来计算模型的表面相交线的工具。

cpp 复制代码
				CGAL_Mesh mesh_orcl;
				std::vector<CGAL_Mesh::Vertex_index> vertexmap;
				for (int j = 0; j < sample; j++)
				{
					Point_3 p(ins_dir[j].x, ins_dir[j].y, ins_dir[j].z);
					CGAL_Mesh::Vertex_index vi = mesh_orcl.add_vertex(p);
					vertexmap.push_back(vi);
				}

				{
					Point_3 p(org.x, org.y, org.z);
					CGAL_Mesh::Vertex_index vi = mesh_orcl.add_vertex(p);
					vertexmap.push_back(vi);
				}

				for (int j = 0; j < sample - 1; j++)
				{
					std::vector<CGAL_Mesh::Vertex_index> vr;
					vr.push_back(vertexmap[j]);
					vr.push_back(vertexmap[j + 1]);
					vr.push_back(vertexmap[vertexmap.size() - 1]);
					CGAL_Mesh::Face_index fi = mesh_orcl.add_face(vr);
				}

				std::vector< std::vector<Point_3> > polyline;

				PMP::surface_intersection(mesh_T, mesh_orcl, std::back_inserter(polyline));

				std::vector<Point_3> line = polyline.at(0);

				std::vector<Point3f> tooth_orc_inter;
				for (int i = 0; i < line.size(); i++)
				{
					Point3f p(line.at(i).x(), line.at(i).y(), line.at(i).z());
					tooth_orc_inter.push_back(p);
				}
相关推荐
格林威19 分钟前
常规线扫描镜头有哪些类型?能做什么?
人工智能·深度学习·数码相机·算法·计算机视觉·视觉检测·工业镜头
Lucis__1 小时前
再探类&对象——C++入门进阶
开发语言·c++
北京不会遇到西雅图2 小时前
【SLAM】【后端优化】不同优化方法对比
c++·机器人
jndingxin2 小时前
c++多线程(6)------ 条件变量
开发语言·c++
程序员莫小特2 小时前
老题新解|大整数加法
数据结构·c++·算法
过往入尘土3 小时前
服务端与客户端的简单链接
人工智能·python·算法·pycharm·大模型
zycoder.3 小时前
力扣面试经典150题day1第一题(lc88),第二题(lc27)
算法·leetcode·面试
蒙奇D索大4 小时前
【数据结构】考研数据结构核心考点:二叉排序树(BST)全方位详解与代码实现
数据结构·笔记·学习·考研·算法·改行学it
洲覆4 小时前
C++ 模板、泛型与 auto 关键字
开发语言·数据结构·c++
智驱力人工智能4 小时前
工厂抽烟检测系统 智能化安全管控新方案 加油站吸烟检测技术 吸烟行为智能监测
人工智能·算法·安全·边缘计算·抽烟检测算法·工厂抽烟检测系统·吸烟监测