Box2D Forums

It is currently Sat May 25, 2013 9:04 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Nov 07, 2009 7:46 am 
Offline

Joined: Sat Nov 07, 2009 7:20 am
Posts: 3
Hi.

I wrote a simple svg2Box2d parser.
Where I'm basically getting all the paths from a SVG convert those into vertices.

Then when i have the vertices i check if the count of vertices are bigger then 8 (b2_maxPolygonVertices) if so use this class:
http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml To split my shapes into smaller vertices.

But when all this is done, i try to create the PolygonShapes everything works fine until sometimes it gets stuck on this method:
Code:
static b2Vec2 ComputeCentroid(const b2Vec2* vs, int32 count)


more specific on this line:
Code:
   // Centroid
   b2Assert(area > B2_FLT_EPSILON);


Anyone got a idea whats the reason?

Cheers
Emil


Top
 Profile  
 
PostPosted: Sat Nov 07, 2009 8:04 am 
Offline

Joined: Mon Jan 07, 2008 10:51 am
Posts: 1911
Drawing inside out shapes? Polygons must be convex and always must be clockwise ordering (or counter clockwise, depending on how you draw). Also, the testbed has a mini SVG parser.


Top
 Profile  
 
PostPosted: Sat Nov 07, 2009 8:27 am 
Offline

Joined: Sat Nov 07, 2009 7:20 am
Posts: 3
Which file contains the svg stuff ?


Top
 Profile  
 
PostPosted: Wed Nov 11, 2009 9:02 am 
Offline

Joined: Fri Mar 14, 2008 12:18 am
Posts: 58
I ran into a similar problem when using triangulated polygons. The most efficient triangulators will sometimes produce very thin triangles. It may be the case that some of the generated triangles are just too small, ie the triangle area is less than float epsilon.

-nick


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 2 guests


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