mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Use Curve instead of this.
Compresses better and allows passing on function as callback.
This commit is contained in:
parent
fb477da0e4
commit
bd3ac02bbe
1 changed files with 9 additions and 9 deletions
|
@ -715,8 +715,8 @@ statics: {
|
|||
// #getIntersections() calls as it is required to create the resulting
|
||||
// CurveLocation objects.
|
||||
getIntersections: function(v1, v2, curve1, curve2, locations) {
|
||||
var bounds1 = this.getBounds(v1),
|
||||
bounds2 = this.getBounds(v2);
|
||||
var bounds1 = Curve.getBounds(v1),
|
||||
bounds2 = Curve.getBounds(v2);
|
||||
/*#*/ if (options.debug) {
|
||||
new Path.Rectangle({
|
||||
rectangle: bounds1,
|
||||
|
@ -734,10 +734,10 @@ statics: {
|
|||
// 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
|
||||
// recalculate since it does not need further subdivision then.
|
||||
if ((this.isLinear(v1)
|
||||
|| this.isFlatEnough(v1, /*#=*/ Numerical.TOLERANCE))
|
||||
&& (this.isLinear(v2)
|
||||
|| this.isFlatEnough(v2, /*#=*/ Numerical.TOLERANCE))) {
|
||||
if ((Curve.isLinear(v1)
|
||||
|| Curve.isFlatEnough(v1, /*#=*/ Numerical.TOLERANCE))
|
||||
&& (Curve.isLinear(v2)
|
||||
|| Curve.isFlatEnough(v2, /*#=*/ Numerical.TOLERANCE))) {
|
||||
/*#*/ if (options.debug) {
|
||||
new Path.Line({
|
||||
from: [v1[0], v1[1]],
|
||||
|
@ -776,11 +776,11 @@ statics: {
|
|||
// Subdivide both curves, and see if they intersect.
|
||||
// If one of the curves is flat already, no further subdivion
|
||||
// is required.
|
||||
var v1s = this.subdivide(v1),
|
||||
v2s = this.subdivide(v2);
|
||||
var v1s = Curve.subdivide(v1),
|
||||
v2s = Curve.subdivide(v2);
|
||||
for (var i = 0; i < 2; i++)
|
||||
for (var j = 0; j < 2; j++)
|
||||
this.getIntersections(v1s[i], v2s[j], curve1, curve2,
|
||||
Curve.getIntersections(v1s[i], v2s[j], curve1, curve2,
|
||||
locations);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue