Skip to content

Bound rotated geometry by the rotated local AABB - #664

Merged
SeanCurtis-TRI merged 3 commits into
flexible-collision-library:masterfrom
xuchen-han:tight-rotated-aabb
Sep 9, 2026
Merged

SeanCurtis-TRI merged 3 commits into
flexible-collision-library:masterfrom
xuchen-han:tight-rotated-aabb

Conversation

@xuchen-han

@xuchen-han xuchen-han commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

computeAABB() bounds a rotated geometry by a cube of half-width
aabb_radius, the circumscribing sphere of the local AABB. For flat or
elongated shapes that box is far looser than the rotated local box,
causing inefficiencies in broadphase collision.

Bound the rotated local AABB instead, with center X * c and half-widths
|R| * h. Since |R| h <= ||h|| = aabb_radius on every axis, the new box is
always contained in the old one and still contains the geometry, so
broadphase results stay conservative. Half spaces and planes report an
unbounded local AABB as extents at the limits of the scalar type, which
overflow the half-width and can reach the rotation as 0 * inf; those keep
the bound built from aabb_center and aabb_radius.


This change is Reviewable

@xuchen-han

Copy link
Copy Markdown
Collaborator Author

Closes #509

The cost of the operation is about ~2x compared to the spherical bound, but it prunes the bvh significantly in downstream Drake's broadphase, cutting the broadphase time (a major bottleneck in Drake simulation with large number of bodies) by ~30%.

@SeanCurtis-TRI SeanCurtis-TRI self-assigned this Aug 27, 2026
@SeanCurtis-TRI

Copy link
Copy Markdown
Contributor

+a:@SeanCurtis-TRI for feature review

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:LGTM: WIth one nit.

@SeanCurtis-TRI reviewed 3 files and all commit messages, and made 3 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on xuchen-han).


include/fcl/narrowphase/collision_object-inl.h line 131 at r1 (raw file):

  // (Graphics Gems, 1990); see Ericson, Real-Time Collision Detection,
  // section 4.2.6.
  const Vector3<S> c_local =

nit: Don't compute c_local, simply use cgeom->aabb_center.


test/test_fcl_collision_object.cpp line 110 at r1 (raw file):

// looser than the looser cube of half-width aabb_radius.
template <typename S>
void TestBoundIsConservative() {

nit: The name of this method is misleading. The test does two things:

  • Confirms the bound is conservative; all of the original box's corners are contained within the bound.
  • Confirms the bound is no worse than bounding the bounding sphere.

Is that second case a test on the "conservative" nature of the box? It feels not. Furthermore, this second test doesn't seem to have long-term value as there is no code path where you could choose to get one or the other. This is merely a test to help the feature reviewer get comfortable with the idea that this change is worthwhile (i.e., it creates a tighter bound). Is that worth repeating in CI over and over?

@xuchen-han xuchen-han left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@xuchen-han made 2 comments and resolved 2 discussions.
Reviewable status: 1 of 3 files reviewed, all discussions resolved (waiting on SeanCurtis-TRI).


include/fcl/narrowphase/collision_object-inl.h line 131 at r1 (raw file):

Previously, SeanCurtis-TRI (Sean Curtis) wrote…

nit: Don't compute c_local, simply use cgeom->aabb_center.

Done.


test/test_fcl_collision_object.cpp line 110 at r1 (raw file):

Previously, SeanCurtis-TRI (Sean Curtis) wrote…

nit: The name of this method is misleading. The test does two things:

  • Confirms the bound is conservative; all of the original box's corners are contained within the bound.
  • Confirms the bound is no worse than bounding the bounding sphere.

Is that second case a test on the "conservative" nature of the box? It feels not. Furthermore, this second test doesn't seem to have long-term value as there is no code path where you could choose to get one or the other. This is merely a test to help the feature reviewer get comfortable with the idea that this change is worthwhile (i.e., it creates a tighter bound). Is that worth repeating in CI over and over?

Done. Renamed and removed the second test.

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now I have to figure out what I'm going to do about CI....blech.

@SeanCurtis-TRI reviewed 2 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on xuchen-han).


include/fcl/narrowphase/collision_object-inl.h line 136 at r2 (raw file):

      (cgeom->aabb_local.max_ - cgeom->aabb_local.min_) * S(0.5);
  const Vector3<S> delta = t.linear().cwiseAbs() * h_local;
  if(delta.allFinite())

BTW Probably worth putting a note on why we only test delta (maximum values for box dimensions getting tipped over the edge by transform). THe same concern doesn't apply to the center.

computeAABB() bounds a rotated geometry by a cube of half-width
aabb_radius, the circumscribing sphere of the local AABB. For flat or
elongated shapes that box is far looser than the rotated local box,
causing inefficiencies in broadphase collision.

Bound the rotated local AABB instead, with center X * c and half-widths
|R| * h. Since |R| h <= ||h|| = aabb_radius on every axis, the new box is
always contained in the old one and still contains the geometry, so
broadphase results stay conservative. Half spaces and planes report an
unbounded local AABB as extents at the limits of the scalar type, which
overflow the half-width and can reach the rotation as 0 * inf; those keep
the bound built from aabb_center and aabb_radius.

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@SeanCurtis-TRI reviewed 1 file and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on xuchen-han).

@xuchen-han xuchen-han left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

#665 in case it helps.

@xuchen-han made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on xuchen-han).

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok...now we'll let CI run through.

@SeanCurtis-TRI reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on xuchen-han).

The old test assumed that the boxes were in one of two discrete states:
tightly-fitting in the identity orientation or supremely overinflated in
any other orientation.

That's no longer true.

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've updated the SaPBroadphase test. It's previous assumptions no longer hold with a more strategically-computed AABB. Now we'll let CI run and see what comes out of it.

@SeanCurtis-TRI made 1 comment.
Reviewable status: 3 of 4 files reviewed, all discussions resolved.

@SeanCurtis-TRI

Copy link
Copy Markdown
Contributor

Huzzah. Merging.

@SeanCurtis-TRI
SeanCurtis-TRI merged commit 708d2e1 into flexible-collision-library:master Sep 9, 2026
5 of 6 checks passed
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