Prebuilt module for commit 803dfb6bb1

This commit is contained in:
Paper.js Bot 2016-06-10 10:36:34 +00:00
parent ca73c52860
commit 5c5c387c53
5 changed files with 52 additions and 37 deletions

View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Fri Jun 10 12:06:08 2016 +0200 * Date: Fri Jun 10 12:33:44 2016 +0200
* *
*** ***
* *
@ -6304,33 +6304,38 @@ statics: {
isStraight: function(l, h1, h2) { isStraight: function(l, h1, h2) {
if (h1.isZero() && h2.isZero()) { if (h1.isZero() && h2.isZero()) {
return true; return true;
} else if (l.isZero()) { } else {
var v = l.getVector(),
epsilon = 2e-7;
if (v.isZero()) {
return false; return false;
} else if (h1.isCollinear(l) && h2.isCollinear(l)) { } else if (l.getDistance(h1) < epsilon
var div = l.dot(l), && l.getDistance(h2) < epsilon) {
p1 = l.dot(h1) / div, var div = v.dot(v),
p2 = l.dot(h2) / div; p1 = v.dot(h1) / div,
p2 = v.dot(h2) / div;
return p1 >= 0 && p1 <= 1 && p2 <= 0 && p2 >= -1; return p1 >= 0 && p1 <= 1 && p2 <= 0 && p2 >= -1;
} }
}
return false; return false;
}, },
isLinear: function(l, h1, h2) { isLinear: function(l, h1, h2) {
var third = l.divide(3); var third = l.getVector().divide(3);
return h1.equals(third) && h2.negate().equals(third); return h1.equals(third) && h2.negate().equals(third);
} }
}, function(test, name) { }, function(test, name) {
this[name] = function() { this[name] = function() {
var seg1 = this._segment1, var seg1 = this._segment1,
seg2 = this._segment2; seg2 = this._segment2;
return test(seg2._point.subtract(seg1._point), return test(new Line(seg1._point, seg2._point),
seg1._handleOut, seg2._handleIn); seg1._handleOut, seg2._handleIn);
}; };
this.statics[name] = function(v) { this.statics[name] = function(v) {
var p1x = v[0], p1y = v[1], var p1x = v[0], p1y = v[1],
p2x = v[6], p2y = v[7]; p2x = v[6], p2y = v[7];
return test(new Point(p2x - p1x, p2y - p1y), return test(new Line(p1x, p1y, p2x, p2y),
new Point(v[2] - p1x, v[3] - p1y), new Point(v[2] - p1x, v[3] - p1y),
new Point(v[4] - p2x, v[5] - p2y)); new Point(v[4] - p2x, v[5] - p2y));
}; };

23
dist/paper-core.js vendored
View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Fri Jun 10 12:06:08 2016 +0200 * Date: Fri Jun 10 12:33:44 2016 +0200
* *
*** ***
* *
@ -6304,33 +6304,38 @@ statics: {
isStraight: function(l, h1, h2) { isStraight: function(l, h1, h2) {
if (h1.isZero() && h2.isZero()) { if (h1.isZero() && h2.isZero()) {
return true; return true;
} else if (l.isZero()) { } else {
var v = l.getVector(),
epsilon = 2e-7;
if (v.isZero()) {
return false; return false;
} else if (h1.isCollinear(l) && h2.isCollinear(l)) { } else if (l.getDistance(h1) < epsilon
var div = l.dot(l), && l.getDistance(h2) < epsilon) {
p1 = l.dot(h1) / div, var div = v.dot(v),
p2 = l.dot(h2) / div; p1 = v.dot(h1) / div,
p2 = v.dot(h2) / div;
return p1 >= 0 && p1 <= 1 && p2 <= 0 && p2 >= -1; return p1 >= 0 && p1 <= 1 && p2 <= 0 && p2 >= -1;
} }
}
return false; return false;
}, },
isLinear: function(l, h1, h2) { isLinear: function(l, h1, h2) {
var third = l.divide(3); var third = l.getVector().divide(3);
return h1.equals(third) && h2.negate().equals(third); return h1.equals(third) && h2.negate().equals(third);
} }
}, function(test, name) { }, function(test, name) {
this[name] = function() { this[name] = function() {
var seg1 = this._segment1, var seg1 = this._segment1,
seg2 = this._segment2; seg2 = this._segment2;
return test(seg2._point.subtract(seg1._point), return test(new Line(seg1._point, seg2._point),
seg1._handleOut, seg2._handleIn); seg1._handleOut, seg2._handleIn);
}; };
this.statics[name] = function(v) { this.statics[name] = function(v) {
var p1x = v[0], p1y = v[1], var p1x = v[0], p1y = v[1],
p2x = v[6], p2y = v[7]; p2x = v[6], p2y = v[7];
return test(new Point(p2x - p1x, p2y - p1y), return test(new Line(p1x, p1y, p2x, p2y),
new Point(v[2] - p1x, v[3] - p1y), new Point(v[2] - p1x, v[3] - p1y),
new Point(v[4] - p2x, v[5] - p2y)); new Point(v[4] - p2x, v[5] - p2y));
}; };

File diff suppressed because one or more lines are too long

23
dist/paper-full.js vendored
View file

@ -9,7 +9,7 @@
* *
* All rights reserved. * All rights reserved.
* *
* Date: Fri Jun 10 12:06:08 2016 +0200 * Date: Fri Jun 10 12:33:44 2016 +0200
* *
*** ***
* *
@ -6304,33 +6304,38 @@ statics: {
isStraight: function(l, h1, h2) { isStraight: function(l, h1, h2) {
if (h1.isZero() && h2.isZero()) { if (h1.isZero() && h2.isZero()) {
return true; return true;
} else if (l.isZero()) { } else {
var v = l.getVector(),
epsilon = 2e-7;
if (v.isZero()) {
return false; return false;
} else if (h1.isCollinear(l) && h2.isCollinear(l)) { } else if (l.getDistance(h1) < epsilon
var div = l.dot(l), && l.getDistance(h2) < epsilon) {
p1 = l.dot(h1) / div, var div = v.dot(v),
p2 = l.dot(h2) / div; p1 = v.dot(h1) / div,
p2 = v.dot(h2) / div;
return p1 >= 0 && p1 <= 1 && p2 <= 0 && p2 >= -1; return p1 >= 0 && p1 <= 1 && p2 <= 0 && p2 >= -1;
} }
}
return false; return false;
}, },
isLinear: function(l, h1, h2) { isLinear: function(l, h1, h2) {
var third = l.divide(3); var third = l.getVector().divide(3);
return h1.equals(third) && h2.negate().equals(third); return h1.equals(third) && h2.negate().equals(third);
} }
}, function(test, name) { }, function(test, name) {
this[name] = function() { this[name] = function() {
var seg1 = this._segment1, var seg1 = this._segment1,
seg2 = this._segment2; seg2 = this._segment2;
return test(seg2._point.subtract(seg1._point), return test(new Line(seg1._point, seg2._point),
seg1._handleOut, seg2._handleIn); seg1._handleOut, seg2._handleIn);
}; };
this.statics[name] = function(v) { this.statics[name] = function(v) {
var p1x = v[0], p1y = v[1], var p1x = v[0], p1y = v[1],
p2x = v[6], p2y = v[7]; p2x = v[6], p2y = v[7];
return test(new Point(p2x - p1x, p2y - p1y), return test(new Line(p1x, p1y, p2x, p2y),
new Point(v[2] - p1x, v[3] - p1y), new Point(v[2] - p1x, v[3] - p1y),
new Point(v[4] - p2x, v[5] - p2y)); new Point(v[4] - p2x, v[5] - p2y));
}; };

File diff suppressed because one or more lines are too long