Implementing 2D CSG (for collision shapes)?

Posted by bluescrn on Game Development See other posts from Game Development or by bluescrn
Published on 2010-11-15T13:42:49Z Indexed on 2011/01/08 20:00 UTC
Read the original article Hit count: 339

Filed under:
|
|
|
|

Are there any simple (or well documented) algorithms for basic CSG operations on 2D polygons?

I'm looking for a way to 'add' a number of overlapping 2D collision shapes. These may be convex or concave, but will be closed shapes, defined as a set of line segments, with no self-intersections.

The use of this would be to construct a clean set of collision edges, for use with a 2D physics engine, from a scene consisting of many arbitrarily placed (and frequently overlapping) objects, each with their own collision shape.

To begin with, I only need to 'add' shapes, but the ability to 'subtract', to create holes, may also be useful.

© Game Development or respective owner

Related posts about 2d

Related posts about math