一位知道如何编写C++的同事帮助解决了这个问题。他想出了以下几点:
while (it != shapes.end()) {
if (Plane* plane = dynamic_cast<Plane*>(it->get()))
{
std::cout << "PLANE_" << count++ << "[" << std::endl;
const std::vector<size_t> indices = it->get()->indices_of_assigned_points();
std::vector<size_t>::const_iterator iti = indices.begin();
while (iti != indices.end()) {
// Retrieves point
Point_with_normal pw = *(points.begin() + (*iti));
Kernel::Point_3 p = pw.first;
std::cout << "POINT[" << p.x() << "," << p.y() << "," << p.z() << "]" << std::endl;
// Proceeds with next point.
iti++;
}
std::cout << "]" << std::endl;
}
// Proceeds with next detected shape.
it++;
}
该块可以取代efficient_RANSAC_parameters.cpp示例中的循环。输出如下:
PLANE_0[
POINT[34.96,584.49,0.47]
POINT[34.97,585.24,0.54]
POINT[34.88,584.51,0.49]
POINT[34.98,584.75,0.49]
]
这给了我一些工作。就我而言,我使用sed将此输出转换为SQL插入查询,这些查询允许我将数据传输到关系数据库以供进一步处理。
OFF用于表示网格,在这里您要保存平面以在其他软件中使用它们。该格式是由其他软件能够读取的内容强加的。 – sloriot
我注意到在其他软件中对OFF有足够的支持。但任何其他非二进制格式都可以,因为我可以使用文本处理来派生其他格式。我只想拥有一个我可以使用的文件。任何将直线坐标写入文本文件的方法都适用于我。 –