Make static getIntersections() methods 'private'.

This commit is contained in:
Jürg Lehni 2015-10-20 10:02:33 +02:00
parent f1debf401b
commit e0c31e4a50
2 changed files with 13 additions and 15 deletions

View file

@ -435,7 +435,7 @@ var Curve = Base.extend(/** @lends Curve# */{
* curves
*/
getIntersections: function(curve) {
return Curve.getIntersections(this.getValues(),
return Curve._getIntersections(this.getValues(),
curve && curve !== this ? curve.getValues() : null,
this, curve, [], {});
},
@ -1692,10 +1692,10 @@ new function() { // Scope for intersection using bezier fat-line clipping
}
return { statics: /** @lends Curve */{
getIntersections: function(v1, v2, c1, c2, locations, param) {
_getIntersections: function(v1, v2, c1, c2, locations, param) {
if (!v2) {
// If v2 is not provided, search for self intersection on v1.
return Curve.getSelfIntersection(v1, c1, locations, param);
return Curve._getSelfIntersection(v1, c1, locations, param);
}
// Avoid checking curves if completely out of control bounds. As
// a little optimization, we can scale the handles with 0.75
@ -1773,7 +1773,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
return locations;
},
getSelfIntersection: function(v1, c1, locations, param) {
_getSelfIntersection: function(v1, c1, locations, param) {
// Read a detailed description of the approach used to handle self-
// intersection, developed by @iconexperience here:
// https://github.com/paperjs/paper.js/issues/773#issuecomment-144018379
@ -1845,7 +1845,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
param.renormalize = function(t1, t2) {
return [t1 * tSplit, t2 * (1 - tSplit) + tSplit];
};
Curve.getIntersections(parts[0], parts[1], c1, c1,
Curve._getIntersections(parts[0], parts[1], c1, c1,
locations, param);
}
}

View file

@ -88,15 +88,13 @@ var PathItem = Item.extend(/** @lends PathItem# */{
var curve1 = curves1[i],
values1 = self ? values2[i] : curve1.getValues(matrix1);
if (self) {
// First check for self-intersections within the same curve
Curve.getIntersections(values1, null, curve1, curve1,
locations, {
include: include,
// Only possible if there is only one closed curve:
startConnected: length1 === 1 &&
curve1.getPoint1().equals(curve1.getPoint2())
}
);
// First check for self-intersections within the same curve.
Curve._getSelfIntersection(values1, curve1, locations, {
include: include,
// Only possible if there is only one closed curve:
startConnected: length1 === 1 &&
curve1.getPoint1().equals(curve1.getPoint2())
});
}
// Check for intersections with other curves. For self intersection,
// we can start at i + 1 instead of 0
@ -108,7 +106,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
var curve2 = curves2[j];
// Avoid end point intersections on consecutive curves when
// self intersecting.
Curve.getIntersections(
Curve._getIntersections(
values1, values2[j], curve1, curve2, locations,
{
include: include,