Remove debug helpers

This commit is contained in:
hkrish 2014-01-26 05:44:55 +01:00
parent aea9a5cd6c
commit 85736d4e84
2 changed files with 9 additions and 67 deletions

View file

@ -71,7 +71,7 @@ PathItem.inject(new function() { // FIXME: Is new necessary?
return path;
}
function computeBoolean(path1, path2, operator, reverse, subtract, res) {
function computeBoolean(path1, path2, operator, reverse, subtract) {
// We do not modify the operands themselves
// The result might not belong to the same type
// i.e. subtraction(A:Path, B:Path):CompoundPath etc.
@ -111,14 +111,6 @@ PathItem.inject(new function() { // FIXME: Is new necessary?
segments.push.apply(segments, paths[i].getSegments());
monoCurves.push.apply(monoCurves, paths[i]._getMonotoneCurves());
}
//DEBUG:---------NOTE: delete ret arg. from unite etc. below---------
if(res){
var cPath = new CompoundPath();
cPath.addChildren(paths, true);
return cPath;
}
//DEBUG:----------------------------------------------
// Propagate the winding contribution. Winding contribution of curves
// does not change between two intersections.
// First, sort all segments with an intersection to the begining.
@ -211,11 +203,11 @@ PathItem.inject(new function() { // FIXME: Is new necessary?
* @param {PathItem} path the path to unite with
* @return {PathItem} the resulting path item
*/
unite: function(path, ret) {
unite: function(path) {
if (!path)
return this;
return computeBoolean(this, path,
function(w) { return w === 1 || w === 0; }, false, false, ret);
function(w) { return w === 1 || w === 0; }, false, false);
},
/**
@ -225,11 +217,11 @@ PathItem.inject(new function() { // FIXME: Is new necessary?
* @param {PathItem} path the path to intersect with
* @return {PathItem} the resulting path item
*/
intersect: function(path, ret) {
intersect: function(path) {
if (!path)
return this;
return computeBoolean(this, path,
function(w) { return w === 2; }, false, false, ret);
function(w) { return w === 2; }, false, false);
},
/**
@ -239,11 +231,11 @@ PathItem.inject(new function() { // FIXME: Is new necessary?
* @param {PathItem} path the path to subtract
* @return {PathItem} the resulting path item
*/
subtract: function(path, ret) {
subtract: function(path) {
if (!path)
return this;
return computeBoolean(this, path,
function(w) { return w === 1; }, true, true, ret);
function(w) { return w === 1; }, true, true);
},
/**

View file

@ -433,18 +433,6 @@ var PathItem = Item.extend(/** @lends PathItem# */{
windRight = 0,
roots = [],
abs = Math.abs;
// DEBUG:--------------------------------------------------
// var check = point.equals([258.2966200492805, 258.54834923463017]);
// var check = window.__checkPoint && point.equals(window.__checkPoint);
// if (check) {
// window.__windLine && window.__windLine.remove();
// window.__windLine = new paper.Path.Line(point.add([-1000, 0]), point.add([1000, 0]));
// window.__windLine.style = style3;
// paper.view.draw();
// }
// DEBUG:-------------------------------------------------
// Absolutely horizontal curves may return wrong results, since
// the curves are monotonic in y direction and this is an
// indeterminate state.
@ -458,12 +446,6 @@ var PathItem = Item.extend(/** @lends PathItem# */{
for (j = roots.length - 1; j >= 0; j--) {
t = roots[j];
y0 = Curve.evaluate(v, t, 0).y;
// DEBUG: ------------------------------------------------
// if (check)
// markPoint(new Point(x, y0), null, null, 0.5);
// DEBUG: ------------------------------------------------
//
if (y0 > y+tolerance && y0 < yBot) {
yBot = y0;
} else if (y0 < y-tolerance && y0 > yTop) {
@ -472,21 +454,12 @@ var PathItem = Item.extend(/** @lends PathItem# */{
}
}
}
// yTop = yTop === -Infinity ? y : yTop;
// yBot = yBot === Infinity ? y : yBot;
// DEBUG: ------------------------------------------------
// var p1 = new Point(x, yTop);
// drawSlopes(point, new Point(x, yTop).subtract(point));
// drawSlopes(point, new Point(x, yBot).subtract(point));
// DEBUG: ------------------------------------------------
yTop = yTop === -Infinity ? y : yTop;
yBot = yBot === Infinity ? y : yBot;
// Shift the point lying on the horizontal curves by
// half of closest top and bottom intercepts.
yTop = (yTop + y) / 2;
yBot = (yBot + y) / 2;
// DEBUG: ------------------------------------------------
// markPoint(new Point(x, yTop), null, null, 0.5);
// markPoint(new Point(x, yBot), null, null, 0.5);
// DEBUG: ------------------------------------------------
windLeft = yTop > -Infinity
? PathItem._getWindingNumber(new Point(x, yTop), curves)
: 0;
@ -520,21 +493,6 @@ var PathItem = Item.extend(/** @lends PathItem# */{
stationary = true;
}
}
// DEBUG:-----------------------
// wind = v[8];
// if (check && (x0 >= xAfter || x0 <= xBefore)){
// if(slope2 && v2) {
// drawSlopes(new paper.Point(x0, y), getTangent(v, t));
// drawSlopes(new paper.Point(v2[6], v2[7]), getTangent(v2, 1));
// }
// hilightCrv(v);
// markPoint(new paper.Point(x0, y), wind, null, 0.01);
// markPoint(Curve.evaluate(v, 0.5, 0), stationary, null, 0.01);
// console.log(t, x0, wind, stationary);
// }
// DEBUG: ----------------
wind = v[8];
if (x0 <= xBefore && !stationary)
windLeft += wind;
@ -542,8 +500,6 @@ var PathItem = Item.extend(/** @lends PathItem# */{
windRight += wind;
}
}
// check && console.log(windLeft, windRight);
// check && console.log(intercepts);
return Math.max(abs(windLeft), abs(windRight));
},
@ -571,9 +527,6 @@ var PathItem = Item.extend(/** @lends PathItem# */{
continue;
// Initialise a new path chain with the seed segment.
path = new paper.Path();
//DEBUG: ------------------------------------------------------
// path.style = styleHi;
wind = seg._winding;
ixOther = seg._intersection;
startSegIx = ixOther ? ixOther._segment : null;
@ -587,9 +540,6 @@ var PathItem = Item.extend(/** @lends PathItem# */{
seg._handleOut));
nextHandleIn = null;
seg._visited = true;
//DEBUG:---------------------------------------------------
// paper.view.draw();
seg = (seg._nextPathSegment ? seg._nextPathSegment :
seg).getNext();
// This segments's _intersection property holds a reference to