Skip to content
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

Fix contact points on c2AABBtoAABBManifold #390

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

Conversation

lmbarros
Copy link
Contributor

Another attempt at fixing a little issue I found in cute_c2. This is working fine in my test cases, though I believe there must be a smarter way of implementing this. 😅


Previously, we would in some cases return contact points that were not within the intersection of the two AABBs. For example,

c2AABB a = {{-3.0, 2.0}, {1.001, 4.001}};
c2AABB b = {{1.0, 4.0}, {2.0, 6.0}};
c2Manifold m;
c2AABBtoAABBManifold(a, b, &m);
printf("p=(%f, %f)\n", m.contact_points[0].x, m.contact_points[0].y);

would print p=(-0.999500, 4.001000).

This commit offsets the "other" coordinate of the contact points so that it lies within the intersection of the two AABBs. With the example above, it now prints p=(1.001000, 4.001000).

Previously, we would in some cases return contact points that were not
within the intersection of the two AABBs. For example,

```c
c2AABB a = {{-3.0, 2.0}, {1.001, 4.001}};
c2AABB b = {{1.0, 4.0}, {2.0, 6.0}};
c2Manifold m;
c2AABBtoAABBManifold(a, b, &m);
printf("p=(%f, %f)\n", m.contact_points[0].x, m.contact_points[0].y);
```

would print `p=(-0.999500, 4.001000)`.

This commit offsets the "other" coordinate of the contact points so that
it lies within the intersection of the two AABBs. With the example
above, it now prints `p=(1.001000, 4.001000)`.
@RandyGaul
Copy link
Owner

Is it possible to add a screenshot showing before/after difference? The change looks innocuous enough, but I'd like to see it visually first if possible

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