参考链接:三维空间中的平面方程
这个链接是错误的: http://blog.csdn.net/PengPengBlog/article/details/52774421
//获取平面方程//Ax + By + Cz + D
std::vector<float> getPlaneParam(const std::vector<pcl::PointXYZ> &votexs)
{
std::vector<float> abcd;
if (votexs.size()<3){
return abcd;
}
else
{//取前三个点计算平面
float x1, x2, x3, y1, y2, y3, z1, z2, z3;
x1 = votexs[0].x; x2 = votexs[1].x; x3 = votexs[2].x;
y1 = votexs[0].y; y2 = votexs[1].y; y3 = votexs[2].y;
z1 = votexs[0].z; z2 = votexs[1].z; z3 = votexs[2].z;
float A = y1*(z2-z3)+y2*(z3-z1)+y3*(z1-z2);
float B = z1*(x2-x3)+z2*(x3-x1)+z3*(x1-x2);
float C = x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2);
float D = -(x1*(y2*z3-y3*z2)+ x2*(y3*z1-y1*z3) + x3*(y1*z2 -y2*z1) );
abcd.push_back(A); abcd.push_back(B); abcd.push_back(C);
abcd.push_back(D);
}
return abcd;
}
以茶壶为例,点云插值的效果如下:
顶点点云:
Mesh图像:
插值点云: