JakeCataford / unity-tinkerbox

A Collection of game-independent unity scripts.
5 stars 1 forks source link

Level Generation has an unnecessary increase in n for one of its algorithms #8

Closed JakeCataford closed 10 years ago

JakeCataford commented 10 years ago

Basically, We clip a set of polygons before producing a boolean using Unite anyways, so there's no need to store each polygon, just each new polygon and the last result of the unite operation.

//contains a set of spots we want to cut out...
List<Polygon> booleanPolygons = List<Polygon>(); 
// The result of the unite operation is MUCH smaller in size, because unite compounds those polygons into as few polygons as possible
// not actually what the code looks like but similar ;)
List<Polygon> result = Clipper.unite(booleanPolygons); 
//so after calculating, just say
booleanPolygons = result;