6

I am working on some C# code in which I would like to take a 2D rectangle and split it to smaller 2D polygons. I would like the effect to look like the rectangle was made of glass and it was hit with a hammer in a random spot. I was wondering if anyone knows of a good algorithm to help me with this. I have tried the FortuneVoronoi code using random points to simulate this effect but am having a hard time turning the finished VoronoiGraph in to a set of non intersecting polygons in a reasonable amount of CPU time.

Jeff Lundstrom
  • 1,043
  • 1
  • 8
  • 22
  • 3
    Interestingly enough, apparently no one knows for sure precisely what mechanisms underly glass fracturing in the first place. http://www.physorg.com/news7864.html – Eric Lippert May 06 '11 at 14:14
  • Cool link to the glass fracture understanding, thanks for that! It does not have to be exact, just a believable simulation. :) – Jeff Lundstrom May 06 '11 at 14:39

1 Answers1

4

Since you mention Voronoi diagrams, I'd go for a Centroidal Voronoi diagram built using a radial density function that is concretated on the point of impact plus some jittering to add a bit of realism. See this page and this paper.

lhf
  • 70,581
  • 9
  • 108
  • 149
  • Excellent suggestion. I will see if I can implement this in a reasonably efficient way. I will be posting all this work publicly once it is complete, it is currently in the form of a simple C# screen saver for testing. Just a fun project I have started is all. – Jeff Lundstrom May 06 '11 at 17:27
  • 1
    @Jeff, try this library, but it's C++,. not C#. http://people.sc.fsu.edu/~jburkardt/cpp_src/cvt/cvt.html – lhf May 06 '11 at 20:24