cloud compare (简称CC)的开发资料相对较少。在写具体的插件时,笔者原本的算法是基于Eigen3矩阵库实现了,需要将ccPointCLoud转换为Eigen3的矩阵Matrix的,代码如下:
//pointer to selected cloud
ccPointCloud* cloud = getSelectedEntityAsCCPointCloud();
if (!cloud)
return -1;
//get selected cloud as Eigen::MatrixXd
unsigned count = cloud->size(); //number of points in the current cell
int total_lines, total_cols;
Eigen::MatrixXd m_pointArbitary(count, 3);
for (unsigned i = 0; i < count; ++i)
{
const CCVector3* P = cloud->getPoint(i);
m_pointArbitary(i, 0) = static_cast<float>(P->x);
m_pointArbitary(i, 1) = static_cast<float>(P->y);
m_pointArbitary(i, 2) = static_cast<float>(P->z);
}