Simplify PathItem#exclude() and #divide()

This commit is contained in:
Jürg Lehni 2013-05-03 16:56:00 -07:00
parent c11967c81c
commit b8fcc9b105

View file

@ -78,18 +78,12 @@ PathItem.inject({
// TODO: cache the split objects and find a way to properly clone them! // TODO: cache the split objects and find a way to properly clone them!
// a.k.a. eXclusiveOR // a.k.a. eXclusiveOR
exclude: function(path) { exclude: function(path) {
var res1 = this.subtract(path); return new Group([this.subtract(path), path.subtract(this)]);
var res2 = path.subtract(this);
var res = new Group([res1, res2]);
return res;
}, },
// Divide path1 by path2 // Divide path1 by path2
divide: function(path) { divide: function(path) {
var res1 = this.subtract(path); return new Group([this.subtract(path), this.intersect(path)]);
var res2 = this.intersect(path);
var res = new Group([res1, res2]);
return res;
}, },
_splitPath: function(_ixs, other) { _splitPath: function(_ixs, other) {