Getting a b2Assert: Polygon is degenerate.

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

Getting a b2Assert: Polygon is degenerate.

Post by pwitulski »

Hello,

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.
b2Assert(false);
SetAsBox(1.0f, 1.0f);
return;
}

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:
https://code.google.com/p/box2d/issues/detail?id=326

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?

Thanks
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Getting a b2Assert: Polygon is degenerate.

Post by iforce2d »

It's a bit hard to say for sure without trying it, but I think you are running into this case:
viewtopic.php?f=7&t=319

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