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

c2TOI returning wrong contact point #357

Open
ramirez7 opened this issue Aug 1, 2023 · 0 comments
Open

c2TOI returning wrong contact point #357

ramirez7 opened this issue Aug 1, 2023 · 0 comments

Comments

@ramirez7
Copy link

ramirez7 commented Aug 1, 2023

I originally brought this up on Discord a while back, but I figured I'd copy it to the issue tracker:


so I'm using the new c2TOI (which returns a c2TOIResult) and the value for p (the contact point) isn't making sense to me. The example I'm doing is testing a stationary AABB and a moving circle.

The only values I'm getting for the p seem to be the AABB's min/max.

λ> c2TOI (c2AABB (C2V 0 0) (C2V 100 100)) (C2V 0 0) (c2Circle (C2V 50 200) 1) (C2V 0 -100) True
C2TOIResult {hit = True, toi = 0.99, n = C2V {x = -0.0, y = 1.0}, p = C2V {x = 100.0, y = 100.0}, iterations = 4}
λ> c2TOI (c2AABB (C2V 0 0) (C2V 100 100)) (C2V 0 0) (c2Circle (C2V 25 -25) 1) (C2V 0 100) True
C2TOIResult {hit = True, toi = 0.24, n = C2V {x = -0.0, y = -1.0}, p = C2V {x = 0.0, y = 0.0}, iterations = 4}

(sorry for the Haskell syntax - I'm testing this in the repl)

In my head, I would expect the first one to collide at (50, 100). And the second, I expect it to collide at (25, 0)


Here's a hand-drawn illustration of expectations vs reality. I marked the p I got in red. And I marked a point e which is what I expected:

image


I've also rigged up a C repro in a MR in my Haskell bindings repository. I did it in the same form as this gist.

hit = 1; toi = 0.990000; n = (-0.000000, 1.000000), p = (100.000000, 100.000000), iterations = 4

image

(Note that I'm using a copy of cute_c2.h in-tree)

@ramirez7 ramirez7 changed the title c2Toi returning wrong contact point c2TOI returning wrong contact point Aug 1, 2023
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

No branches or pull requests

1 participant