Skip to content
forked from heelong/CDT-DEM

三角化,delaunay 边界

Notifications You must be signed in to change notification settings

layshua/CDT-DEM

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

CDT-DEM

数据说明: 数据存放在~CDT\DEM文件夹中 bounding.txt:约束三角剖分后输出的边界点文件 c.txt:原始边界点文件 mesh.ply:三角网文件 point.txt:三角剖分的算法的输入数据 point1.txt:原始点云数据

格式: bounding.txt、c.txt、point1.txt存的都是散点格式数据

mesh.ply: ply format ascii 1.0 comment Author: CloudCompare (TELECOM PARISTECH/EDF R&D) obj_info Generated by CloudCompare! element vertex 9859 property double x property double y property double z element face 17849 property list uchar int vertex_indices end_header 391970.5000000 3261349.0000000 165.0000000 391970.3125000 3261392.0000000 175.0000000 ……………………. 3 1865 5758 6120 3 5275 2794 6458 …………………..

point.txt point 8586 391970.50000000 3261349.00000000 165.00000000 391970.31250000 3261392.00000000 175.00000000 ………………………. bounding 1813 391351.906250 3260653.000000 120.000000 391353.812500 3260656.000000 120.000000 ……………………….

研究思路与方法 第一步:数据读入 先读入进行三角剖分的点云数据到数组中,再读入边界点云数据到数组中。在读入边界点云数据时判断边界点是否已在数组中,如果在,则记录其在数组中的索引到边界索引数组中。如果不在点云数组中,则将该边界点放入到点云数组的最末尾,并记录其在数组中的位置到索引数组中。 如果需要运行,需要将主函数的两个文件路径改成自己电脑上相应的文件路径 std::string str1="E:\SpecializedCourses\DEM\CDT\DEM\point.txt"; std::string str2="E:\SpecializedCourses\DEM\CDT\DEM\mesh.ply";

第二步:DT三角剖分 使用的是增量三角剖分的方法,首先添加一个超级三角形,包含所有数据,然后在逐点插入数据点到三角网中,细化三角网。 第三步:约束条件加入 如果想查看没有进行约束条件的效果,将void IncrementalDelaunay(MESH_PTR pMesh)函数中相应位置的代码隐去: // 边界约束 for(int i=0;ibounding_index.size()-1;++i) { Insert(pMesh,pMesh->bounding_index[i],pMesh->bounding_index[i+1],i+1); } 第四步:删除三角形 删除包含超级三角形顶点的三角形,删除由边界点构成的三角形。 第五步:输出 在void Output(std::string pFile, MESH_PTR pMesh)函数中修改输出新边界数据的路径 std::ofstream outfile("E:\SpecializedCourses\DEM\CDT\DEM\bounding.txt");

代码中每个函数及相应变量都有详细备注,请参看代码。

About

三角化,delaunay 边界

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%