free-language / box2d

Automatically exported from code.google.com/p/box2d
0 stars 0 forks source link

Only swap contacts whey they are not the same #162

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Inside b2Island.cpp on line 221 you have the following:

b2Swap(m_contacts[i1], m_contacts[i2]);

however, sometimes when b2Swap is called, the i1 and i2 indexes are the same 
(i1 = 1 and i2 = 2).

Should the b2Swap method only be called when i1 != i2?

Using rev 141.

Original issue reported on code.google.com by Qvist...@gmail.com on 3 Nov 2010 at 12:36

GoogleCodeExporter commented 9 years ago
Since when does 1 == 2?

Original comment by erinca...@gmail.com on 7 Nov 2010 at 12:49

GoogleCodeExporter commented 9 years ago
Woops, my fault. It should have said i2 = 1.

Original comment by Qvist...@gmail.com on 7 Nov 2010 at 12:50

GoogleCodeExporter commented 9 years ago
It is just swapping pointers. Adding logic to check for i1 == i2 will just slow 
down the code.

Original comment by erinca...@gmail.com on 27 Mar 2011 at 9:42