mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix #getCrossings() where calling #getPoint() / #getTangent() was slow and also wrong when a matrix was used.
This commit is contained in:
parent
8606f25542
commit
8928a7b057
1 changed files with 4 additions and 4 deletions
|
@ -319,13 +319,13 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
|
|||
crossings = 0;
|
||||
for (var i = 0, l = roots != Infinity && roots.length; i < l; i++) {
|
||||
var t = roots[i];
|
||||
if (t >= 0 && t < 1 && this.getPoint(t).x > point.x) {
|
||||
if (t >= 0 && t < 1 && Curve.evaluate(vals, t, 0).y > point.x) {
|
||||
// If we're close to 0 and are not changing y-direction from the
|
||||
// previous curve, do not count this root, as we're merely
|
||||
// touching a tip.
|
||||
if (t < Numerical.TOLERANCE
|
||||
&& this.getPrevious().getTangent(1).y
|
||||
* this.getTangent(t).y >= 0)
|
||||
if (t < Numerical.TOLERANCE && Curve.evaluate(
|
||||
this.getPrevious().getValues(matrix), 1, 1).y
|
||||
* Curve.evaluate(vals, t, 1).y >= 0)
|
||||
continue;
|
||||
crossings++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue