Skip to content

Conversation

@at-wat
Copy link
Contributor

@at-wat at-wat commented Dec 25, 2025

Fix #6382

@at-wat
Copy link
Contributor Author

at-wat commented Dec 25, 2025

Failure in Build (Build MSVC Windows Build x64) seems be unrelated to this PR.

2025-12-25T05:39:20.8546283Z   99: [ RUN      ] PCL.Octree_Pointcloud_Adjacency
2025-12-25T05:39:20.8690475Z   99: C:\__w\1\s\test\octree\test_octree.cpp(1608): error: Expected equality of these values:
2025-12-25T05:39:20.8691162Z   99:   27
2025-12-25T05:39:20.8691640Z   99:   leaf_container->size ()
2025-12-25T05:39:20.8692130Z   99:     Which is: 18
2025-12-25T05:39:20.8692624Z   99: 
2025-12-25T05:39:20.8693111Z   99: [  FAILED  ] PCL.Octree_Pointcloud_Adjacency (13 ms)

@mvieth
Copy link
Member

mvieth commented Dec 25, 2025

First of all, thank you for reporting the issue and for opening a pull request.
I think that adding the additional class member num_initial_convex_selection_retry_ plus getter/setter methods is overkill, and might be more confusing to users than helpful. Also, in the edge cases you pointed out, the while loop is still quite inefficient, even with limited retries. Looking at the similar class ConcaveHull, there, simply the whole input cloud is used to determine the projection direction. Perhaps we can use a "hybrid" approach in ConvexHull: try once with a set of 3 points (either first-middle-last point or 3 random points) and check if these form a valid triangle (with the existing stableNorm check). This should handle the majority of (benign) cases quickly and efficiently. Otherwise, use the whole input cloud like in ConcaveHull, to handle all edge cases. What do you think?

@at-wat
Copy link
Contributor Author

at-wat commented Dec 26, 2025

My purpose is just to make it never enter the infinite loop for any input, so the simpler solution would be fine with me.
The hybrid approach should work perfectly, at least in my usage.

I first considered minimizing the logical difference to keep the compatibility as much as possible.
However, before 1.15, inputs that doesn't form a triangle weren't detected and left the loop due to a lack of floating point tolerance. These edge cases didn't actually affect any users. So, changing the logic here should be fine.

@mvieth mvieth added module: surface changelog: fix Meta-information for changelog generation labels Dec 26, 2025
Co-authored-by: Markus Vieth <39675748+mvieth@users.noreply.github.com>
Copy link
Member

@mvieth mvieth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@mvieth mvieth merged commit a425bac into PointCloudLibrary:master Dec 27, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: fix Meta-information for changelog generation module: surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[surface] ConvexHull::reconstruct enters an infinite loop

3 participants