Skip to content

Modeling - Optimize BndLib and add GTests - #856

Merged
dpasukhi merged 3 commits into
Open-Cascade-SAS:IRfrom
dpasukhi:bndlib_impr
Nov 27, 2025
Merged

dpasukhi merged 3 commits into
Open-Cascade-SAS:IRfrom
dpasukhi:bndlib_impr

Conversation

@dpasukhi

Copy link
Copy Markdown
Member

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

  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
@dpasukhi dpasukhi added this to the Release 8.0 milestone Nov 26, 2025
@dpasukhi
dpasukhi requested a review from Copilot November 26, 2025 12:10
@dpasukhi dpasukhi self-assigned this Nov 26, 2025
@dpasukhi dpasukhi added 2. Bug Something isn't working 2. Enhancement New feature or request labels Nov 26, 2025
@dpasukhi dpasukhi added the 1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... label Nov 26, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread src/ModelingData/TKGeomBase/BndLib/BndLib.cxx
Comment thread src/ModelingData/TKGeomBase/BndLib/BndLib.cxx
@dpasukhi

Copy link
Copy Markdown
Member Author

Test i will fix after review, it is just one of the value now is 1e-2 different

Comment thread src/ModelingData/TKGeomBase/BndLib/BndLib_AddSurface.cxx Outdated
@github-project-automation github-project-automation Bot moved this from Todo to Integration in Maintenance Nov 27, 2025
@dpasukhi
dpasukhi merged commit c04f5e0 into Open-Cascade-SAS:IR Nov 27, 2025
23 checks passed
@dpasukhi
dpasukhi deleted the bndlib_impr branch November 27, 2025 09:22
@github-project-automation github-project-automation Bot moved this from Integration to Done in Maintenance Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... 2. Bug Something isn't working 2. Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants