Skip to content

[BUG FIX] Minor bug in support functions for collision detection #1259

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SonSang
Copy link

@SonSang SonSang commented Jun 10, 2025

Description

There was a minor bug in support functions for box and capsule in collision detection algorithm. Specifically, ti.math.sign gives 0 when the input is 0, which is undesirable, when we require either 1 or -1 for finding support points. Therefore, fixed the value to 1 when the output is 0.

Related Issue

Motivation and Context

It fixes wrong collision detection results when the support direction has 0 value.

How Has This Been / Can This Be Tested?

Screenshots (if appropriate):

Checklist:

  • I read the CONTRIBUTING document.
  • I followed the Submitting Code Changes section of CONTRIBUTING document.
  • I tagged the title correctly (including BUG FIX/FEATURE/MISC/BREAKING)
  • I updated the documentation accordingly or no change is needed.
  • I tested my changes and added instructions on how to test it for reviewers.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

duburcqa
duburcqa previously approved these changes Jun 10, 2025
@duburcqa duburcqa enabled auto-merge (squash) June 10, 2025 06:12
@YilingQiao
Copy link
Collaborator

You can install a pre-commit hook which could format the code before a commit.

pip install pre-commit
pre-commit install

auto-merge was automatically disabled June 10, 2025 15:34

Head branch was pushed to by a user without write access

@duburcqa duburcqa enabled auto-merge (squash) June 10, 2025 15:52
@duburcqa
Copy link
Collaborator

The failing test is flaky. I will improve. Sorry but your PR is stuck for now :/

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.

3 participants