Use groups for compound boolean operations

This commit is contained in:
hkrish 2013-05-01 22:55:05 +02:00
parent 1d1bfdc529
commit 454632571b

View file

@ -328,20 +328,14 @@ function subtract( path1, path2, _cache ){
function exclude( path1, path2 ){
var res1 = subtract( path1, path2 );
var res2 = subtract( path2, path1 );
res1 = ( res1 instanceof CompoundPath )? res1.children : [ res1 ];
res2 = ( res2 instanceof CompoundPath )? res2.children : [ res2 ];
var res = new CompoundPath();
res.addChildren( res1.concat( res2 ), true );
var res = new Group( [res1, res2] );
return res;
}
function divide( path1, path2 ){
var res1 = subtract( path1, path2 );
var res2 = intersect( path1, path2 );
res1 = ( res1 instanceof CompoundPath )? res1.children : [ res1 ];
res2 = ( res2 instanceof CompoundPath )? res2.children : [ res2 ];
var res = new CompoundPath();
res.addChildren( res1.concat( res2 ), true );
var res = new Group( [res1, res2] );
return res;
}