Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue May 22, 2012 7:55 am 
Offline

Joined: Mon Apr 19, 2010 12:59 pm
Posts: 6
Our project is using "bullet" in linux server for collision detection.
bug:
Create btBvhTriangleMeshShape with useQuantizedAabbCompression = true, we found incrrect collision detection result frequently. If useQuantizedAabbCompression = false, everything is just perfect. But it costs much more memory!
fix:
btQuantizedBvh.h
Code:
int getTriangleIndex() const
{
       btAssert(isLeafNode());  // Get only the lower bits where the triangle index is stored
       return (m_escapeIndexOrTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS)));
}

(~0)<<(31-MAX_NUM_PARTS_IN_BITS) should change to 0xffffffff<<(31-MAX_NUM_PARTS_IN_BITS)


(~0) is recognized as negative value in gcc probaly.
Shift operators for negative value is implementation-defined and gcc compiler implements defferent shift operation against visual studio c++(vs9) compiler


Top
 Profile  
 
PostPosted: Fri May 25, 2012 10:57 am 
Offline

Joined: Fri Aug 01, 2008 6:36 am
Posts: 144
Location: Bonn, Germany
Have you opened an issue? I looked at C++ standard (open-std.org) and so far "<<" is undefined if on left side is negative value.
There is also one in btSoftBodyConcaveCollisionAlgorithm.h (line 48).
Thank you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group