Skip to content

Add bounding box support#212

Merged
bschwind merged 16 commits intobschwind:mainfrom
TEECOM:tmk/add-brepbnd
Jun 24, 2025
Merged

Add bounding box support#212
bschwind merged 16 commits intobschwind:mainfrom
TEECOM:tmk/add-brepbnd

Conversation

@tymokvo
Copy link
Copy Markdown
Contributor

@tymokvo tymokvo commented Jun 16, 2025

Summary

  • Add bounding_box module wrapping Bnd_Box and BRepBndLib
  • Add tests
  • Add bounding_box example

Description

I need to compute bounding boxes of OCC geometry for a project that uses opencascade. Thankfully, OCC has the BRepBndLib package that supports this already. This adds a wrapper for the BRepBndLib::Add method and the underlying Bnd_Box class on which it depends.

To support this and show how to use it, there are a few simple tests and an example that uses the viewer to show the bounded and bounding geometry.

One thing that I didn't understand, but that I assume is important to the underlying algorithms in OCC, is that the Bnd_Box has a small Gap value that is added to every dimension of the box. I decided to expose this as gap_vec to make it easier to work with in the rust side and tried to document it clearly.

Copy link
Copy Markdown
Owner

@bschwind bschwind left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! I'd like to format the decimal literals in bounding_box.rs but I'll handle that.

Comment thread crates/opencascade/src/bounding_box.rs Outdated
Comment thread crates/opencascade/src/bounding_box.rs Outdated
Comment thread crates/opencascade/src/bounding_box.rs Outdated
Comment thread crates/opencascade/src/bounding_box.rs Outdated
Comment thread crates/opencascade/src/bounding_box.rs Outdated
Comment thread crates/opencascade/src/bounding_box.rs Outdated
@tymokvo
Copy link
Copy Markdown
Contributor Author

tymokvo commented Jun 22, 2025

Ah thanks! Sorry I missed those!

@bschwind
Copy link
Copy Markdown
Owner

No worries! I wish rustfmt had a stable option to format them so you don't even have to think about it. I think someone had proposed it but I don't know if it ever got implemented.

@bschwind bschwind merged commit 2eefc2c into bschwind:main Jun 24, 2025
4 checks passed
@tymokvo tymokvo deleted the tmk/add-brepbnd branch June 24, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants