Page 1 of 1

Creating a Mosaic Application

Posted: Wed Feb 17, 2010 6:29 am
by mtrigaux
Hey Guys,

Just started using RevMedia, I am looking to create a mosaic type of application where I can create a shape and then click a button to make that shape "shatter" into a bunch of pieces. Those smaller pieces will then be used by the user to drag and re-arrange to create a mosaic in the same window. Any advice for best way to have a shape randomly split? Thanks so much!

--Matt

Re: Creating a Mosaic Application

Posted: Wed Feb 17, 2010 2:22 pm
by BvG
I don't know exactly what your question is. So I answer two in your general direction. Note: links go to wikipedia

You want to know how to make rev divide an object for you.

If you can absolutely not start with an object that is already pre-seperated, then this is not very simple. So the easy route is to "fake" the shattering by having a "whole" object, and meanwhile having the "splinters" hidden away somehow, then exchanging them. If you want to do it the hard way, I suggest looking at the irregular polygon. As you can define points, you can create slices using cartesian geometry, and then copy those new points into other irregular polygons (created on the fly). Alternatively, you can use the "import snapshot" command, either with pre-made forms that you put behind your object, or by using rectangles.

You want to know some math that makes dividing objects look fancy, regular or special in some way.

You could create a pre-made map of puzzle pieces, which you then superimpose over the object to be divided. They'd need to be stored in cartesian coordinates. Then you can create the slices from the object along those pre-made borders. Another way is to use some tessellation algorithm, personally, I'm very fond of delaunay tessellation (or more precisely it's inverse, the voronoi diagram). You can also randomly calculate lines that cut trough your object, but this might be too random (extremely large and one pixel pieces might result, depending on how you do it).
Many people like uniform tiling, and there's some nice math behind those that you can build on.

Re: Creating a Mosaic Application

Posted: Wed Feb 17, 2010 7:24 pm
by mtrigaux
Great BvG thanks so much for the reply! I think I'll look into possibly having the puzzle already pre-made and hiding the "splinters". Those diagram wiki links are great, thanks for the info!