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

False positives can appear #1

Closed
walseb opened this issue Mar 23, 2020 · 2 comments · Fixed by #3
Closed

False positives can appear #1

walseb opened this issue Mar 23, 2020 · 2 comments · Fixed by #3
Assignees
Labels

Comments

@walseb
Copy link

walseb commented Mar 23, 2020

These are two identical convex boxes a long distance from each other and yet collision returns Just True:

(It becomes easier to read with word-wrap on)

λ> collision 99999 ([(1874.9342045000049, (-50.0)),(1874.9342045000049, 50.0),(1974.9342045000049, 50.0),(1974.9342045000049, (-50.0))], polySupport) (([(450.0, (-50.0)),(450.0, 50.0), (550.0, 50.0), (550.0, (-50.0))]), polySupport)
Just True

From my testing it seems as if you have one very high precision (double) convex box and compare that against another one with integer precision (both are using the same datatype), false-positives can appear:

λ> collision 99999 ([(1874.9342045000049, (-50.0)),(1874.9342045000049, 50.0),(1974.9342045000049, 50.0),(1974.9342045000049, (-50.0))], polySupport) (([(450.0, (-50.0)),(450.0, 50.0),(550.0, 50.0),(550.0, (-50.0))]), polySupport)
Just True
λ> collision 99999 ([(1874.9342045000049, (-50.0)),(1874.9342045000049, 50.0),(1974.9342045000049, 50.0),(1974.9342045000049, (-50.0))], polySupport) (([(450.0000000000001, (-50.0000000000001)),(450.0000000000001, 50.0000000000001),(550.0000000000001, 50.0000000000001),(550.0000000000001, (-50.0000000000001))]), polySupport)
Just False
λ> collision 99999 ([(1874.9342045000049, (-50.0)),(1874.9342045000049, 50.0),(1974.9342045000049, 50.0),(1974.9342045000049, (-50.0))], polySupport) (([(450.0000000000000, (-50.0000000000000)),(450.0000000000000, 50.0000000000000),(550.0000000000000, 50.0000000000000),(550.0000000000000, (-50.0000000000000))]), polySupport)
Just True
λ> collision 99999 ([(1874.9342045000049, (-50.0)),(1874.9342045000049, 50.0),(1974.9342045000049, 50.0),(1974.9342045000049, (-50.0))], polySupport) (([(449.9999999999999, (-49.9999999999999)),(449.9999999999999, 49.9999999999999),(549.9999999999999, 49.9999999999999),(549.9999999999999, (-49.9999999999999))]), polySupport)
Just False
λ> collision 99999 ([(1874, (-50.0)),(1874, 50.0),(1974, 50.0),(1974, (-50.0))], polySupport) (([(450, (-50)),(450, 50),(550, 50),(550, (-50))]), polySupport)
Just False

As you can see, simply adding zeroes to the second box won't fix it, but adding something trivial like 0000000000001 seems to. Also if you look at the last prompt, removing the decimals from the first cube makes it work properly again, so it has something to do with the precision

Maybe this is just a inherent problem of the algorithm? I haven't looked into it or tried this with other GJK packages.

@zaidan zaidan self-assigned this Mar 24, 2020
@zaidan zaidan added the bug label Mar 24, 2020
zaidan added a commit that referenced this issue Mar 24, 2020
`d1` with y = `0.0` results in false positves, use `-1.0` instead.
zaidan added a commit that referenced this issue Mar 24, 2020
`d1` with y = `0.0` results in false positves, use `-1.0` instead.
@zaidan
Copy link
Owner

zaidan commented Mar 24, 2020

@walseb thx, for finding this bug. The bug was caused by using y = 0.0 for d1 - see: 9c71e25#diff-4f64b18c58764991e6cf79d74e3a8e33R33

@zaidan zaidan closed this as completed in #3 Mar 24, 2020
zaidan added a commit that referenced this issue Mar 24, 2020
Fix #1: False positives can appear
zaidan added a commit to zaidan/elm-collision that referenced this issue Mar 24, 2020
@walseb
Copy link
Author

walseb commented Mar 24, 2020

Wow thanks for fixing this so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants