-
Notifications
You must be signed in to change notification settings - Fork 53
[OUTDATED] Make no-overlap a built-in solver behavior #573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2f3b5f7
29ca957
20b60fc
908d1e4
a5956ee
ad73c6d
11bb480
abadd09
20dae96
5f0ecdc
762f937
4afa420
2d0fb0c
bb62b35
511a417
00102fa
bfe2274
620cf73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -298,16 +298,29 @@ def _validate_no_overlap( | |
| self, | ||
| positions: dict[Object | ObjectReference, tuple[float, float, float]], | ||
| ) -> bool: | ||
| """Check that no two objects overlap in 3D (axis-aligned bbox with margin).""" | ||
| """Check that no two objects overlap in 3D (axis-aligned bbox with clearance margin). | ||
|
|
||
| All pairs must be separated by at least ``clearance_m``. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A minor question: Do we plan to have the same
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that's a good point, we might want to add this in the future. For now I think we should go with simplicity. |
||
| Anchor-to-anchor pairs are skipped (both fixed, user's responsibility). | ||
| """ | ||
| anchor_objects = get_anchor_objects(list(positions.keys())) | ||
| anchor_set = set(anchor_objects) | ||
| objects = list(positions.keys()) | ||
| # Small tolerance to avoid false positives at floating-point boundaries | ||
| # (e.g., On relation places child exactly at clearance_m above parent). | ||
| margin = max(0.0, self.params.solver_params.clearance_m - 1e-6) | ||
|
|
||
| for i in range(len(objects)): | ||
| for j in range(i + 1, len(objects)): | ||
| a, b = objects[i], objects[j] | ||
|
|
||
| if a in anchor_set and b in anchor_set: | ||
| continue | ||
|
|
||
| a_world = a.get_bounding_box().translated(positions[a]) | ||
| b_world = b.get_bounding_box().translated(positions[b]) | ||
|
|
||
| if a_world.overlaps(b_world, margin=self.params.min_separation_m): | ||
| if a_world.overlaps(b_world, margin=margin): | ||
| if self.params.verbose: | ||
| print(f" Overlap between '{a.name}' and '{b.name}'") | ||
| return False | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea good move to remove this from the EnvBuilder.