mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Minor code tweaks.
This commit is contained in:
parent
c69ea345da
commit
86f404123e
3 changed files with 5 additions and 8 deletions
|
@ -1330,8 +1330,8 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
|||
var reparametrize = param.reparametrize;
|
||||
if (reparametrize) {
|
||||
var res = reparametrize(t1, t2);
|
||||
t1 = res.t1;
|
||||
t2 = res.t2;
|
||||
t1 = res[0];
|
||||
t2 = res[1];
|
||||
}
|
||||
loc = new CurveLocation(c1, t1, p1 || Curve.getPoint(v1, t1),
|
||||
null, overlap,
|
||||
|
|
|
@ -103,7 +103,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
|||
if (l1.intersect(l2, false)) {
|
||||
// Self intersecting is found by dividing the curve in two
|
||||
// and and then applying the normal curve intersection code.
|
||||
var parts = Curve.subdivide(values1);
|
||||
var parts = Curve.subdivide(values1, 0.5);
|
||||
Curve._getIntersections(parts[0], parts[1], curve1, curve1,
|
||||
locations, {
|
||||
// Only possible if there is only one closed curve:
|
||||
|
@ -113,10 +113,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
|||
reparametrize: function(t1, t2) {
|
||||
// Since the curve was split above, we need to
|
||||
// adjust the parameters for both locations.
|
||||
return {
|
||||
t1: t1 / 2,
|
||||
t2: (1 + t2) / 2
|
||||
};
|
||||
return [t1 / 2, (1 + t2) / 2];
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -58,7 +58,7 @@ var PathIterator = Base.extend({
|
|||
// appears to offer a good trade-off between speed and
|
||||
// precision for display purposes.
|
||||
&& !Curve.isFlatEnough(curve, tolerance || 0.25)) {
|
||||
var split = Curve.subdivide(curve),
|
||||
var split = Curve.subdivide(curve, 0.5),
|
||||
halfT = (minT + maxT) / 2;
|
||||
// Recursively subdivide and compute parts again.
|
||||
computeParts(split[0], index, minT, halfT);
|
||||
|
|
Loading…
Reference in a new issue