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:
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 ac2TOIResult
) and the value forp
(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.(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:
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.
(Note that I'm using a copy of
cute_c2.h
in-tree)