[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Triangulation of Concave Polgygons in C/C++

Triangulation of Concave Polgygons in C/C++

Official forum for the .

Triangulation of Concave Polgygons in C/C++

Postby sketch » Mon Aug 12, 2013 9:30 am

Hi,

I would first like to say good job with Chipmunk! It's super easy to use, supports all interesting joint types, and is quite fast. I have tried both Box2d and PhysX but they pale in comparison to Chipmunk for what I need in 2D. It's a nice engine!

Right now I'm at a point where I need to triangulate a concave polygon with no holes. The polygon is constructed from an ordered set of points along the hull (in CW or CCW order).

Chipmunk Pro has Autogeometry features, and I managed to find examples of its use in Objective-C (http://chipmunk-physics.net/forum/viewtopic.php?t=813), but I cannot seem to find the documentation on how to use this feature directly from C/C++.

Can anyone point me in the right direction where I can read more on this?

Another solution I found was CGAL (http://www.cgal.org) but the library is huge and I only need one small feature from it so I would like to avoid using it.

Thank you,
Rados
sketch
 
Posts: 3
Joined: Mon Aug 12, 2013 9:03 am

Re: Triangulation of Concave Polgygons in C/C++

Postby LegoCylon » Mon Aug 12, 2013 10:08 am

It sounds like you may already have the set of vertices. If so you can just create a body with segment shapes between each vertex with a little bit of beveling and enable segment-to-segment collision.

If you do not have the points, I use OpenCV to do edge detection in my level editor. It is also a large library but I only include OpenCV_core and OpenCV_imgproc. cv::findContours returns a set of contours with vertices. You can think of each contour as a separate polygon. Once I have the vertices I follow the same procedure as above using segment shapes. It's pretty quick to update but I have not tried using it in real time in my game so I don't know how well it performs in that context on a mobile device.
LegoCylon
 
Posts: 29
Joined: Wed May 09, 2012 12:06 am

Re: Triangulation of Concave Polgygons in C/C++

Postby sketch » Mon Aug 12, 2013 10:46 am

Thank you for the reply! I'm sort of trying to see if Chuimunk has some triangulation functions exposed. I should have been a bit more clear!

I have objects which are collections of bodies, shapes, and constraints, and through some wizardry I return the object's concave hull. Now I would like to triangulate the computed hull and feed it to OpenGL.

I am looking for some helper functions which will help me with the triangulation. I think Chipmunk has such functions, but I cannot find the documentation about it. Does Chipmunk provide this at all?

Cheers,
R
sketch
 
Posts: 3
Joined: Mon Aug 12, 2013 9:03 am

Re: Triangulation of Concave Polgygons in C/C++

Postby slembcke » Mon Aug 12, 2013 1:54 pm

Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Triangulation of Concave Polgygons in C/C++

Postby sketch » Mon Aug 12, 2013 6:23 pm

Thank you for your quick reply! That is precisely what I'm looking for :)

Is the functionality not available in the Pro Trial? I downloaded the pro trial to test it, But I cannot locate the Polyline classes.

EDIT:

Ah I did not see that the Pro download is for the iOS Pro trial. But it is great that Chipmunk has the ACD feature. It is definitely a handy one. It will save me quite a bit of trouble down the road.

Thank you again for the information and your fast reply.

Cheers,
R
sketch
 
Posts: 3
Joined: Mon Aug 12, 2013 9:03 am


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 1 guest

cron