# games logic based on closed shapes

I would like to know the math concepts behind shape based games like http://www.miniclip.com/games/fat-slice/en/

To be specific, I would like to know on

• how to model shapes programmatically
• finding areas of shapes
• intersection of areas
• curvy shapes instead of polygons

I searched for tutorials / guides to the best of my knowledge, but couldn't find anything appropriate.

Edit: I am looking at C++ libraries, that would support iOS / Android.

-
You can just write your own based on my answer – AB. Mar 25 '13 at 13:39
I prefer to use any library that performs all this under the hood and provides simple consumable APIs, rather than writing on my own. I am looking into Boost::Geometry, which more or less relates to my requirement. – saiy2k Mar 26 '13 at 10:02

You might be interested in shapes.

It is an c# with XNA library to work with shapes of every kind. I dont know what language / platform you are targeting but with the source code provided by codeplex you should get an idea of how to handle shape creation, collision and picking.

Slicing is a problem for itself, you need either to composit your shapes of smaller shapes and split them after slice, which would be the easier approach, but also limit the player. Or you regenerate your new shapes with your algorithm after the users sliced the old one.

Depending on your desired shapes you may want to have a look at metaballs, which handle composition of bodies (and therefore shapes in 2D) from particles.

-
• how to model shapes programmatically
• finding areas of shapes
• intersection of areas
• curvy shapes instead of polygons

1) If you mean how to modify the shapes programmatically just add 2 new vertices at the intersection points. 2) Find areas using the good old Divide and Conquer. It all looks to me like a set of linked rectangles and triangles. It's easy to compute the area using basic shapes 3) What do you mean by that? I can see any areas intersecting. 4) If you wan to get curvy I'd suggest approximating curves with triangles. Other approaches will require more power and coding.

-