Fixed division bug in max_inscribed_ball causing test_max_ball failure#454
Fixed division bug in max_inscribed_ball causing test_max_ball failure#454Shorya777 wants to merge 3 commits intoGeomScale:developfrom
Conversation
|
Hey @Shorya777 , in calcstep line 45, it seems the grouping of the division has changed during refactoring. just verify pls |
|
also using std::max(denom, eps) is risky if denom is negative. In optimization edge cases, if the denominator is a small negative number, safe_div will flip its sign to positive eps, leading to incorrect directional updates, a better approach would be to using the ternary operation something like (denom >= 0 ? std::max(denom, eps) : std::min(denom, -eps)) to preserve the sign just verify pls |
yeah I fixed it now! I just saw that because of it |
yeah I think that would be a problem. Working on it. |
|
Hi @vissarion and @TolisChal, I would appreciate your feedback on this PR when you have time. Please let me know if any adjustments are needed. |
Akash504-ai
left a comment
There was a problem hiding this comment.
Thanks for addressing this and correcting the formula, with the fixes in place and tests passing...this looks good.
vissarion
left a comment
There was a problem hiding this comment.
Thanks for this PR.
Could you please explain why did you decide to use NT(1e-12)? Is it part of some experimentation?
Fixes - #453
This PR resolves the numerical instability reported in #453 by introducing a safeguarded division helper to prevent divisions by extremely small values during the interior-point iterations of max_inscribed_ball.
Implementation
Added a helper function:
The unstable division was replaced with guarded divisions using safe_div, ensuring that denominators do not approach zero.
Testing
test_max_ballnow passes.