Getting a b2Assert: Polygon is degenerate.

Report problems here (or use the built-in feedback dialog in the editor)
Post Reply
Posts: 8
Joined: Sat Aug 17, 2013 4:48 pm

Getting a b2Assert: Polygon is degenerate.

Post by pwitulski » Sun Sep 28, 2014 1:12 am


So I will try to explain this and hopefully it makes sense.

A while back after I made something in RUBE and loaded a scene using box2d everything was fine. I updated the sdk that I was using and it had the same box2d version (2.3.0), however the some of the code is different and it traces back to this function:

void b2PolygonShape::Set(const b2Vec2* vertices, int32 count)

where there is a new section of code that does a check

n = tempCount;
if (n < 3)
// Polygon is degenerate.
SetAsBox(1.0f, 1.0f);

this is where my application breaks and brings up the call stack. If I remove the assertion, I can see where it does not like a rectangle I have made and puts that 1 by 1 box in place of it.

Doing a google search I found this link where someone submitted a potential bug:

I am not sure if Erik has written that check code for this bug, Is there something programmed in RUBE that verifies the polygons, perhaps there is a little bug somewhere?


Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Getting a b2Assert: Polygon is degenerate.

Post by iforce2d » Sun Sep 28, 2014 4:10 am

It's a bit hard to say for sure without trying it, but I think you are running into this case:

Since you are using 2.3.0 you should be able to just swap out the b2Polygon.cpp file completely. If this doesn't work out let me know.

Post Reply