i have a plane with holes. For this plane, I determine the coefficients using pcl::SACSegmentation<PointT>. I get the coefficients, for example: 0.506008 -0.862525 -0.00234344 -2.8741 , where they stand for ax + by + cz + d = 0 for the normal point equation of a plane.
I have been knocking my brain out, how to construct a new plane, at the same position as the old one is using these very coeffients.
I have basically determined the min and max positions of my plane (with holes) using pcl::getMinMax3D(*cloud_filtered, minPt, maxPt);
Then i take a point which I know lies on the plane (I get this from the SACSegmentaiton inliers).
temp.x = cloud_filtered->points[inliers->indices.at(10)].x;
temp.y = cloud_filtered->points[inliers->indices.at(10)].y;
temp.z = cloud_filtered->points[inliers->indices.at(10)].z;
Then I go through all points within this range of min max and calcualte new x,y,z positions to solve the above plane equation for the new input points. I think this is where I go wrong, but I don't know how to do it right, even after a day of research on the topic plane equation.
The result is not even a 1 point thick plane (it is more like several points next to each other, red in upper screenshot) but even worse it is at a totally different position (blue in screenshot below, red with green outline is my original cloud with holes).
Can someone please push me into the right direction?
Re: how to construct a plane from plane coefficients
This post was updated on .
okay, i made a mistake in rearranging the normal point equation (Ax+By+Cz=D), dropped the D somehow... (this is not showing in the above code as it really made some nonsense).
So replace the 3 lines in the for-loop by this and it works: