Box2D Forums

It is currently Wed May 22, 2013 10:28 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: c++ Error
PostPosted: Sat Feb 18, 2012 9:20 am 
Offline

Joined: Tue Oct 25, 2011 5:36 am
Posts: 10
I got an error when im using this ? why?


this error :
Quote:
Asserion failed: s > 0.0f && "ERROR: Please ensure your polygon is conex and h
gonShape.cpp


Code:
   b2PolygonShape dynamicBox;
   int num = 4;

   b2Vec2 vertices[] = {b2Vec2(1.500,2.500),
                        b2Vec2(3.500,3.500),
                        b2Vec2(5.500,12.500),
                        b2Vec2(1.500,4.500),
                        b2Vec2(-1.500,2.500),
                        b2Vec2(-1.500,4.500),
                        b2Vec2(-3.500,3.500),
                        b2Vec2(-21.500,0.500),
                        b2Vec2(-13.500,0.500),
                        b2Vec2(5.500,12.500),
                        b2Vec2(-13.500,12.500),
                        b2Vec2(-21.500,4.500),
                        b2Vec2(21.500,0.500),
                        b2Vec2(21.500,4.500),
                        b2Vec2(13.500,12.500),
                        b2Vec2(5.500,12.500),
                        b2Vec2(12.500,0.500),
                        b2Vec2(-13.500,16.500),
                        b2Vec2(-13.500,12.500),
                        b2Vec2(-5.500,12.500),
                        b2Vec2(-5.500,16.500),
                        b2Vec2(5.500,16.500),
                        b2Vec2(5.500,12.500),
                        b2Vec2(13.500,12.500),
                        b2Vec2(13.500,16.500),
                        b2Vec2(13.500,-3.500),
                        b2Vec2(15.500,-3.500),
                        b2Vec2(17.500,-1.500),
                        b2Vec2(17.500,0.500),
                        b2Vec2(13.500,0.500),
                        b2Vec2(-17.500,11.500),
                        b2Vec2(-16.400,10.650),
                        b2Vec2(-13.500,12.500),
                        b2Vec2(-17.500,12.500),
                        b2Vec2(-5.500,-16.500),
                        b2Vec2(-3.500,-15.500),
                        b2Vec2(-3.500,3.500),
                        b2Vec2(-9.500,-3.500),
                        b2Vec2(-9.500,-12.500),
                        b2Vec2(-11.500,-3.500),
                        b2Vec2(-9.500,-3.500),
                        b2Vec2(-3.500,3.500),
                        b2Vec2(-12.500,0.500),
                        b2Vec2(-12.500,-2.500),
                        b2Vec2(-14.500,-3.500),
                        b2Vec2(-13.500,-2.500),
                        b2Vec2(-13.500,0.500),
                        b2Vec2(-17.500,0.500),
                        b2Vec2(-17.500,-1.500),
                        b2Vec2(-15.500,-3.500),
                        b2Vec2(17.500,11.500),
                        b2Vec2(17.500,12.500),
                        b2Vec2(13.500,12.500),
                        b2Vec2(16.500,10.500),
                        b2Vec2(11.500,-3.500),
                        b2Vec2(12.500,-2.500),
                        b2Vec2(12.500,0.500),
                        b2Vec2(5.500,12.500),
                        b2Vec2(3.500,3.500),
                        b2Vec2(9.500,-3.500),
                        b2Vec2(5.500,-16.500),
                        b2Vec2(9.500,-12.500),
                        b2Vec2(9.500,-3.500),
                        b2Vec2(3.500,3.500),
                        b2Vec2(3.500,-15.500),
                        b2Vec2(-16.400,10.650),
                        b2Vec2(-16.500,9.500),
                        b2Vec2(-13.500,12.500),
                        b2Vec2(16.500,10.500),
                        b2Vec2(13.500,12.500),
                        b2Vec2(16.500,9.500),
                        b2Vec2(1.500,4.500),
                        b2Vec2(5.500,12.500),
                        b2Vec2(-1.500,4.500),
                        b2Vec2(5.500,12.500),
                        b2Vec2(-13.500,0.500),
                        b2Vec2(-12.500,0.500),
                        b2Vec2(-3.500,3.500),
                        b2Vec2(-1.500,4.500)};




   dynamicBox.Set(vertices,num);


Top
 Profile  
 
 Post subject: Re: c++ Error
PostPosted: Sat Feb 18, 2012 10:38 am 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1517
Location: Tokyo
So... is the polygon convex? Can we assume that you have altered the default settings to allow polygons of more than 8 sides?
The latest version of Box2D in svn will create a polygon from the convex hull of the supplied points so you don't see this problem, maybe you could try that.


Top
 Profile  
 
 Post subject: Re: c++ Error
PostPosted: Sun Feb 19, 2012 11:19 am 
Offline

Joined: Tue Oct 25, 2011 5:36 am
Posts: 10
Yes i have Set the Maximum to 1000 and recompiled it its an other Error


Top
 Profile  
 
 Post subject: Re: c++ Error
PostPosted: Sun Feb 19, 2012 3:02 pm 
Offline

Joined: Sun Oct 25, 2009 3:28 am
Posts: 242
Hm, I'm not sure what the problem is. Have you tried just having four vertices in the array (not 79) to create the polygon? If you haven't tried it, try making an array of just 4 vertices and use that to create the polygon to see if it still spits out an error.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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:
Powered by phpBB® Forum Software © phpBB Group