Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A simple closed polygonal curve generation algorithm

I need an algorithm to generate a closed simple (no self-intersections) polygonal curve. It would make a perfect labyrinth for my game.

A rough example of what I need

Can you please point me to the correct keywords?

like image 637
Hedin Avatar asked Jul 30 '12 10:07

Hedin


1 Answers

One idea: generate a bunch of random points, then enclose them using alpha shapes.

There's a parameter you can tune to decide how "tight" the resulting polygon is.


Another idea: generate a bunch of random shapes (eg. generate random simpler polygons, or use metaballs), then compute their union.

You may need to resort to some tricks to make sure the union is only a single shape, though.

like image 118
BlueRaja - Danny Pflughoeft Avatar answered Sep 30 '22 13:09

BlueRaja - Danny Pflughoeft