这段代码可能存在问题,因为在第二个 for 循环中,它将新的平面添加到了 planes1 向量中,但是在第一个 for 循环中,它又使用了 planes1 向量中的数据来插入点。这可能导致重复的点或者点的数量不正确。

另外,变量 index 没有在代码中定义,这也可能导致问题。

以下是可能存在问题的代码片段:

Point_set ptsshiyan;
int ind = 0;
for (size_t i = 0; i < planes1.size(); i++)
{
    for (size_t j = 0; j < planes1[i].size(); j++)
    {
        
        ptsshiyan.insert(planes1[i][j]);
    }
}
UCmap redLabel11 = ptsshiyan.add_property_map<unsigned char>('red', 0).first;

for (size_t i = 0; i < planes1.size(); i++)
{
    std::vector<Point> plane;
    int red = rand() % 255;

    for (size_t j = 0; j < planes1[i].size(); j++)
    {
        
        plane.push_back(ptsshiyan.point(index));
        redLabel11[ind] = red;
        index++;
        
    }
    planes1.push_back(plane);
}

建议您仔细检查代码,确保 planes1 向量在两个 for 循环中的使用方式正确,并定义 index 变量。

C++ 代码分析:使用 Point_set 和 planes1 数组的潜在问题

原文地址: https://www.cveoy.top/t/topic/jXvr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录