mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Improve comments.
This commit is contained in:
parent
277ab844f2
commit
4110a56521
2 changed files with 6 additions and 2 deletions
|
@ -316,8 +316,8 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
|
|||
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 we're close to 0 and are not changing y-direction from.
|
||||
// previous curve, do not count this solution, as we're merely
|
||||
// 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
|
||||
&& prevSlope * this.getTangent(t).y >= 0)
|
||||
|
|
|
@ -1166,6 +1166,10 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
|||
point = Point.read(arguments);
|
||||
if (!this._closed || !this.getBounds().contains(point))
|
||||
return false;
|
||||
// Use the crossing number algorithm, by counting the crossings of the
|
||||
// beam in right y-direction with the shape, and see if it's an odd
|
||||
// number, meaning the starting point is inside the shape.
|
||||
// http://en.wikipedia.org/wiki/Point_in_polygon
|
||||
var curves = this.getCurves(),
|
||||
prevCurve = this.getLastCurve(),
|
||||
crossings = 0;
|
||||
|
|
Loading…
Reference in a new issue