PointCloudLibrary / PointCloudLibrary/pcl
GreedyProjectionTriangulation class resulting grid normals are reversed
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
When I used this class to generate grids, I found that some grids were found to be opposite, resulting in the display effect of exported STL file being different from that of PCL visual window. I would like to ask if there is any method to repair the normal line
And I found that when using the same method of normal estimation, neither Poisson nor moving cube will have the opposite situation of normal, only greedy projection method will
PCL visualization

STL file display

` std::cout << "Using mls method estimation..." << endl;;
pcl::PointCloudpcl::PointNormal mls_points1;
pcl::PointCloudpcl::PointNormal::Ptr mls_points(new pcl::PointCloudpcl::PointNormal());
pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls;
cout << "MLS前点云数:" << cloudTranslated->points.size() << endl;
mls.setComputeNormals(true);
mls.setInputCloud(cloudTranslated);
mls.setPolynomialOrder(true);
// mls.setDilationIterations(10);
//mls.setDilationVoxelSize(0.5);
//mls.setSqrGaussParam(2.0);
//mls.setUpsamplingRadius(5);
mls.setPolynomialOrder (3);
//mls.setPointDensity(30);
mls.setSearchMethod(kdtree_for_points);
mls.setSearchRadius(3);
mls.process(*mls_points);
pcl::PointCloud<pcl::PointXYZ>::Ptr temp(new pcl::PointCloud<pcl::PointXYZ>());
for (int i = 0; i < mls_points->points.size(); i++) {
pcl::PointXYZ pt;
pt.x = cloud->points[i].x;
pt.y = cloud->points[i].y;
pt.z = cloud->points[i].z;
temp->points.push_back(pt);
}
cout << "MLS后点云数目 :" << mls_points->points.size() << endl;
cout << "temp :" << temp->points.size() << endl;
pcl::concatenateFields(*temp, *mls_points, *cloud_with_normals);
std::cout << "移动最小二乘法线估计完成" << std::endl;
cout << "最小二乘cloud_with_normals:" << cloud_with_normals->points.size() << endl;
pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3;
gp3.setSearchRadius(search_radius);//It was 0.025
gp3.setMu(setMU); //It was 2.5
gp3.setMaximumNearestNeighbors(maxiNearestNeighbors); //It was 100
gp3.setMaximumSurfaceAngle(M_PI/2); // 45 degrees //it was 4
gp3.setMinimumAngle(M_PI/4); // 10 degrees //It was 18
gp3.setMaximumAngle(M_PI/1.2); // 120 degrees //it was 1.5
gp3.setNormalConsistency(false); //It was false
gp3.setConsistentVertexOrdering(true);
gp3.setInputCloud(cloud_with_normals);
gp3.setSearchMethod(kdtree_for_normals);
gp3.reconstruct(triangles);
std::string output_dir1 = "D://Program Files//CloudPoint//model_converted_pcd//dragon_mesh.stl";
pcl::io::savePolygonFileSTL(output_dir1.c_str(), triangles, true);
`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the GreedyProjectionTriangulation configuration and its reconstruct call, using the provided MovingLeastSquares normal-estimation pipeline as the reproduction. Compare the generated triangles and normals with the PCL visualization and exported STL; done means the cause is identified and the resulting grid orientation is consistent between both views.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100