TOI Infinite loop...

Based upon the google svn: rev#6

I am not sure where we are posting bugs now being as we've moved away from source-forge. Are we using the system on google?

Anyway, I am seeing an infinite loop under certain circumstances. I modified the pyramid test-bed example to get it to happen consistently which really just involve in increasing the numbers of blocks (see below).

I am seeing it never getting out of the "void b2World::SolveTOI(const b2TimeStep& step)" function inside the "for (;;)" section.

Code:
   enum
   {
      e_count = 50,
   };

   Pyramid()
   {
      {
         b2BodyDef bd;
         b2Body* ground = m_world->CreateBody(&bd);

         b2PolygonShape shape;
         shape.SetAsEdge(b2Vec2(-40.0f, 0.0f), b2Vec2(40.0f, 0.0f));
         ground->CreateFixture(&shape);
      }

        {
         b2PolygonShape shape;
            shape.SetAsBox( 1.0f, 1.0f, b2Vec2(0.0f,0.0f), b2_pi * 0.25f );
         b2BodyDef bd;
            bd.position .Set( 0.0f, 5.0f );
         b2Body* body = m_world->CreateBody(&bd);
         body->CreateFixture(&shape, 5.0f);
        }

      {
         float32 a = 0.25f;
         b2PolygonShape shape;
         shape.SetAsBox(a, a);

         b2Vec2 x(-10.0f, +10.75f);
         b2Vec2 y;
         b2Vec2 deltaX(0.5625f, 1.25f);
         b2Vec2 deltaY(1.125f, 0.0f);
            deltaX *= 0.5f;
            deltaY *= 0.5f;

         for (int32 i = 0; i < e_count; ++i)
         {
            y = x;

            for (int32 j = i; j < e_count; ++j)
            {
               b2BodyDef bd;
               bd.position = y;
               b2Body* body = m_world->CreateBody(&bd);
               body->CreateFixture(&shape, 5.0f);
               body->SetMassFromShapes();

               y += deltaY;
            }

            x += deltaX;
         }
      }
   }
Thanks, I put this issue up on Google:

http://code.google.com/p/box2d/issues/list
I posted a bug on SourceForge about it as well, I forgot you moved to Google, sorry =P

I am experiencing this bug in the SVN version as well, assuming it's the same thing. Under this loop:

Code:
         // Determine when intervals intersect.
         int32 rootIterCount = 0;
         for (;;)


in function:
Code:
template <typename TA, typename TB>
float32 b2TimeOfImpact(const b2TOIInput* input, const TA* shapeA, const TB* shapeB)


I'll experiment to see if I can implement a catch to just end the loop and give up after 50 tries, perhaps that's the best way to handle this?

-P

Original thread: https://box2d.org/forum/viewtopic.php?t=3549