部分代码展示:
(1)利用格网法计算面积:
//(2)测试使用格网法计算平面点云面积
void main()
{
char *inputpath = "D:\\testdata\\data.txt";
vector<pcl::PointXYZ> points = ReadPointXYZIntoVector(inputpath);
double area_01 = statisGrids(points, 0.5);
double area_02 = statisGrids(points, 1.0);
double area_03 = statisGrids(points, 2.0);
double area_04 = statisGrids(points, 3.0);
cout << "格网尺寸为0.5时面积 " << area_01 << endl;
cout << "格网尺寸为1.0时面积 " << area_02 << endl;
cout << "格网尺寸为2.0时面积 " << area_03 << endl;
cout << "格网尺寸为3.0时面积 " << area_04 << endl;
system("pause");
}
(2)利用鞋带定理矩阵计算面积:文章来源:https://www.toymoban.com/news/detail-832858.html
//(5)利用鞋带矩阵定理计算面积
void main()
{
char *filepath = "D:\\testdata\\data.txt";
vector<pcl::PointXYZ> origipts = ReadPointXYZIntoVector(filepath);
//假设其z坐标都为0,为平面坐标
for (int i = 0; i < origipts.size(); i++)
{
origipts[i].z = 0;
}
vector<pcl::PointXYZ> boundpts, nonbounpts;
double r = 0.8;
Bounpts(origipts, r, boundpts, nonbounpts);
double area = AreaCalculation(boundpts);
cout << "使用边缘点计算的点云面积为 " << area << endl;
cout << "真实点云面积为 1078.23" << endl;
system("pause");
}
源代码及测试数据下载链接:https://download.csdn.net/download/qq_32867925/88847794文章来源地址https://www.toymoban.com/news/detail-832858.html
到了这里,关于详解平面点云面积计算的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!