Modeling - Optimize BndLib and add GTests - #856
Merged
Merged
Conversation
Bug fixes:
- Fix negative modulo in torus bounding box computation
- Fix hyperbola extrema loop early break condition
- Fix OpenMin/OpenMax direction sign for infinite bounds
- Remove dead code in cone bounding computation
Optimizations:
- Replace sqrt/log with more efficient computations in hyperbola bounds
- General code cleanup and modernization
Testing:
- Add comprehensive GTest suite (61 tests) covering BndLib,
BndLib_Add2dCurve, BndLib_Add3dCurve, and BndLib_AddSurface
There was a problem hiding this comment.
Pull request overview
This PR optimizes the BndLib (bounding box library) module by fixing bugs, improving performance, and adding comprehensive test coverage. Key fixes include correcting negative modulo handling in torus computation, fixing hyperbola extrema loop logic, and resolving infinite bound direction signs. Performance improvements include replacing expensive sqrt/log operations and adding loop precomputation. The PR adds 61 GTests covering all major functionality.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
BndLib_Test.cxx |
New comprehensive test suite with 61 tests covering BndLib core functionality, 2D/3D curves, and surfaces |
FILES.cmake |
Registers new test file in build system |
BndLib.cxx |
Core optimizations: replaces macros with modern C++, fixes infinite bound direction logic, optimizes torus/hyperbola computation, fixes negative modulo bug |
BndLib_Add3dCurve.cxx |
Optimizes pole-based box reduction with structured bindings and modern C++ idioms, converts static to constexpr |
BndLib_Add2dCurve.cxx |
Performance improvements: replaces C math functions with std:: equivalents, improves type safety with static_cast |
BndLib_AddSurface.cxx |
Loop optimization: precomputes step sizes to eliminate repeated division, modernizes assignment operator |
Member
Author
|
Test i will fix after review, it is just one of the value now is 1e-2 different |
…ters and add comprehensive tests
AtheneNoctuaPt
approved these changes
Nov 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug fixes:
Optimizations:
Testing: