From 533322a8275dcdddae26b2cf7c94675da8c2344d Mon Sep 17 00:00:00 2001 From: Joost Nieuwenhuijse Date: Tue, 21 Feb 2012 14:50:48 +0100 Subject: [PATCH] Speed optimizations --- csg.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/csg.js b/csg.js index 2496b29..76b1e99 100644 --- a/csg.js +++ b/csg.js @@ -412,11 +412,19 @@ CSG.prototype = { // resolution: number of points per 360 degree for the rounded corners expand: function(radius, resolution) { var result=this; + var count = 0; this.polygons.map(function(p) { var expanded=p.expand(radius, resolution); - result=result.unionSub(expanded, true, false); + result=result.unionSub(expanded, false, false); + count++; + if(count == 30) + { + result = result.reTesselated(); + count = 0; + } }); - result = result.canonicalized(); +// result = result.canonicalized(); + result = result.reTesselated(); result.properties = this.properties; // keep original properties return result; },