mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Merge branch 'master' of https://github.com/paperjs/paper.js
* 'master' of https://github.com/paperjs/paper.js: Undo recent change to Curve#getIntersection() since it breaks some boolean operations. ý5:q
This commit is contained in:
commit
e75cc32a3b
1 changed files with 10 additions and 15 deletions
|
@ -716,9 +716,7 @@ statics: {
|
||||||
// We need to provide the original left curve reference to the
|
// We need to provide the original left curve reference to the
|
||||||
// #getIntersections() calls as it is required to create the resulting
|
// #getIntersections() calls as it is required to create the resulting
|
||||||
// CurveLocation objects.
|
// CurveLocation objects.
|
||||||
getIntersections: function(v1, v2, curve1, curve2, locations,
|
getIntersections: function(v1, v2, curve1, curve2, locations) {
|
||||||
// Pass on isFlat1 / isFlat2 parameters in iterative calls
|
|
||||||
isFlat1, isFlat2) {
|
|
||||||
var bounds1 = this.getBounds(v1),
|
var bounds1 = this.getBounds(v1),
|
||||||
bounds2 = this.getBounds(v2);
|
bounds2 = this.getBounds(v2);
|
||||||
/*#*/ if (options.debug) {
|
/*#*/ if (options.debug) {
|
||||||
|
@ -738,13 +736,10 @@ statics: {
|
||||||
// because they have no control points at all, or are "flat enough"
|
// because they have no control points at all, or are "flat enough"
|
||||||
// If the curve was flat in a previous iteration, we don't need to
|
// If the curve was flat in a previous iteration, we don't need to
|
||||||
// recalculate since it does not need further subdivision then.
|
// recalculate since it does not need further subdivision then.
|
||||||
if (!isFlat1)
|
if ((this.isLinear(v1)
|
||||||
isFlat1 = this.isLinear(v1)
|
|| this.isFlatEnough(v1, /*#=*/ Numerical.TOLERANCE))
|
||||||
|| this.isFlatEnough(v1, /*#=*/ Numerical.TOLERANCE);
|
&& (this.isLinear(v2)
|
||||||
if (!isFlat2)
|
|| this.isFlatEnough(v2, /*#=*/ Numerical.TOLERANCE))) {
|
||||||
isFlat2 = this.isLinear(v2)
|
|
||||||
|| this.isFlatEnough(v2, /*#=*/ Numerical.TOLERANCE);
|
|
||||||
if (isFlat1 && isFlat2) {
|
|
||||||
/*#*/ if (options.debug) {
|
/*#*/ if (options.debug) {
|
||||||
new Path.Line({
|
new Path.Line({
|
||||||
from: [v1[0], v1[1]],
|
from: [v1[0], v1[1]],
|
||||||
|
@ -778,12 +773,12 @@ statics: {
|
||||||
// Subdivide both curves, and see if they intersect.
|
// Subdivide both curves, and see if they intersect.
|
||||||
// If one of the curves is flat already, no further subdivion
|
// If one of the curves is flat already, no further subdivion
|
||||||
// is required.
|
// is required.
|
||||||
var v1s = isFlat1 ? [v1] : this.subdivide(v1),
|
var v1s = this.subdivide(v1),
|
||||||
v2s = isFlat2 ? [v2] : this.subdivide(v2);
|
v2s = this.subdivide(v2);
|
||||||
for (var i = 0, l = v1s.length; i < l; i++)
|
for (var i = 0; i < 2; i++)
|
||||||
for (var j = 0, k = v2s.length; j < k; j++)
|
for (var j = 0; j < 2; j++)
|
||||||
this.getIntersections(v1s[i], v2s[j], curve1, curve2,
|
this.getIntersections(v1s[i], v2s[j], curve1, curve2,
|
||||||
locations, isFlat1, isFlat2);
|
locations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return locations;
|
return locations;
|
||||||
|
|
Loading…
Reference in a new issue