Inconsistent output from btGjkPairDetector::getClosestPoints

Post Reply
billchurch76
Posts: 4
Joined: Wed Jun 12, 2019 2:20 pm

Inconsistent output from btGjkPairDetector::getClosestPoints

Post by billchurch76 » Wed Jun 12, 2019 2:28 pm

I've attached a project that demonstrates the issue. Essentially, I've built two hulls and depending on the order in which I pass them into a btGjkPairDetector object, I get different values for getClosestPoints, either -0.08 or 7.18. Also, if I reorder the points used to build the hulls, then the output becomes consistent (-0.08). I didn't see anything in the documentation to suggest that the hulls had to be build with a specific point ordering, so I'm curious as to why there is a difference in the output.
Attachments
StovePipe.zip
(7.79 MiB) Downloaded 15 times

User avatar
drleviathan
Posts: 545
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Inconsistent output from btGjkPairDetector::getClosestPoints

Post by drleviathan » Thu Jun 13, 2019 12:22 am

When I run it I get:

Code: Select all

d12 = -0.0800091
d21 = -0.0799984
These values seem close enough to me. The GJK algorithm is an iterative algorithm which must decide when to exit. Depending on its path through the Minkowski space it could take a longer or shorter path and end up with slightly different answers.

billchurch76
Posts: 4
Joined: Wed Jun 12, 2019 2:20 pm

Re: Inconsistent output from btGjkPairDetector::getClosestPoints

Post by billchurch76 » Thu Jun 13, 2019 6:55 pm

You ran it exactly as is? Did you change the version of Bullet it links against. Because I just redownloaded it and ran it and still get:
7.17892885 and -0.0799984410

If I change the #if from 0 to 1, then I get:
-0.0799984410 and -0.0799877569

I don't see how you'd get different answers with the exact same code.
Attachments
IF_DEF_1.PNG
IF_DEF_1.PNG (2.79 KiB) Viewed 1253 times
IF_DEF_0.PNG
IF_DEF_0.PNG (2.75 KiB) Viewed 1253 times

User avatar
drleviathan
Posts: 545
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Inconsistent output from btGjkPairDetector::getClosestPoints

Post by drleviathan » Thu Jun 13, 2019 7:17 pm

No, our build configs are not the same.

I think I'm using Bullet 2.87. I copied most of your StovePipeDlg.cpp code into another project I had already had cmake build configuration all setup. I'm building on linux with g++ 7.4.0.

billchurch76
Posts: 4
Joined: Wed Jun 12, 2019 2:20 pm

Re: Inconsistent output from btGjkPairDetector::getClosestPoints

Post by billchurch76 » Fri Jun 14, 2019 12:48 pm

Ok, sweet, so maybe this has already been fixed and I just need to upgrade my version of Bullet. I'll try that and report back.

billchurch76
Posts: 4
Joined: Wed Jun 12, 2019 2:20 pm

Re: Inconsistent output from btGjkPairDetector::getClosestPoints

Post by billchurch76 » Fri Jun 14, 2019 1:10 pm

That's it! I updated to the latest 2.88 and it's working fine. My apologies, I should have thought to have done that.

Post Reply