Skip to content

[Simulation.Graph] Add tests for the node bounding box - #6442

Open
fredroy wants to merge 1 commit into
sofa-framework:masterfrom
fredroy:bbox_add_unit_tests
Open

fredroy wants to merge 1 commit into
sofa-framework:masterfrom
fredroy:bbox_add_unit_tests

Conversation

@fredroy

@fredroy fredroy commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

(This PR is just here to showcase the next PR about fixing Node's bbox)

Add 4 unit tests about setting nodes' bbox :

  • computedBBoxFollowsObjects without a given bbox, it is computed at init and follows the objects when they move;
  • bboxSetBeforeInitIsKept / bboxSetAfterInitIsKept: a bbox written after the node creation (e.g. root.bbox = ... from Python, or from a controller) is kept by init and by UpdateBoundingBoxVisitor;
  • bboxFromSceneAttributeIsKeptAndIncludedInParent: a bbox given as a scene attribute (Node::parse) is kept, and the computed bbox of the parent includes it along with its computed siblings.

bboxSetBeforeInitIsKept and bboxSetAfterInitIsKept fail in this branch: a bbox written after the node creation is overwritten.

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

NodeBBox_test covers how a node bbox is computed or kept:
- computedBBoxFollowsObjects: without a given bbox, it is computed at
  init and follows the objects when they move;
- bboxSetBeforeInitIsKept / bboxSetAfterInitIsKept: a bbox written after
  the node creation (e.g. `root.bbox = ...` from Python, or from a
  controller) is kept by init and by UpdateBoundingBoxVisitor;
- bboxFromSceneAttributeIsKeptAndIncludedInParent: a bbox given as a
  scene attribute (Node::parse) is kept, and the computed bbox of the
  parent includes it along with its computed siblings.

bboxSetBeforeInitIsKept and bboxSetAfterInitIsKept fail at this commit:
a bbox written after the node creation is overwritten. Fixed by the
next commit.
@fredroy fredroy added pr: status to review To notify reviewers to review this pull-request pr: test PR adding test(s) in SOFA pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI labels Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI pr: status to review To notify reviewers to review this pull-request pr: test PR adding test(s) in SOFA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant