Some comment cleanup.

This commit is contained in:
Jürg Lehni 2016-02-05 20:31:58 +01:00
parent 5a46620768
commit ffe42a0220

View file

@ -306,7 +306,7 @@ PathItem.inject(new function() {
/** /**
* Private method that returns the winding contribution of the given point * Private method that returns the winding contribution of the given point
* with respect to a given set of monotone curves. * with respect to a given set of monotonic curves.
*/ */
function getWinding(point, curves, horizontal) { function getWinding(point, curves, horizontal) {
var epsilon = /*#=*/Numerical.WINDING_EPSILON, var epsilon = /*#=*/Numerical.WINDING_EPSILON,
@ -314,10 +314,10 @@ PathItem.inject(new function() {
py = point.y, py = point.y,
windLeft = 0, windLeft = 0,
windRight = 0, windRight = 0,
isOnCurve = false,
length = curves.length, length = curves.length,
roots = [], roots = [],
abs = Math.abs, abs = Math.abs;
isOnCurve = false;
// Horizontal curves may return wrong results, since the curves are // Horizontal curves may return wrong results, since the curves are
// monotonic in y direction and this is an indeterminate state. // monotonic in y direction and this is an indeterminate state.
if (horizontal) { if (horizontal) {
@ -357,9 +357,8 @@ PathItem.inject(new function() {
values = curve.values, values = curve.values,
yStart = values[1], yStart = values[1],
yEnd = values[7]; yEnd = values[7];
// The first curve of a loop holds the last curve with // The first curve of a loop holds the last curve with non-zero
// non-zero winding. // winding. Retrieve and use it here (See _getMonoCurve()).
// Retrieve and use it here (See _getMonoCurve()).
if (curve.last) { if (curve.last) {
// Get the end x coordinate and winding of the last // Get the end x coordinate and winding of the last
// non-horizontal curve, which will be the previous // non-horizontal curve, which will be the previous
@ -367,10 +366,10 @@ PathItem.inject(new function() {
prevWinding = curve.last.winding; prevWinding = curve.last.winding;
prevXEnd = curve.last.values[6]; prevXEnd = curve.last.values[6];
} }
// Since the curves are monotone in y direction, we can just // Since the curves are monotonic in y direction, we can just
// compare the endpoints of the curve to determine if the // compare the endpoints of the curve to determine if the ray
// ray from query point along +-x direction will intersect // from query point along +-x direction will intersect the
// the monotone curve. // monotonic curve.
if (py >= yStart && py <= yEnd || py >= yEnd && py <= yStart) { if (py >= yStart && py <= yEnd || py >= yEnd && py <= yStart) {
if (winding) { if (winding) {
// Calculate the x value for the ray's intersection. // Calculate the x value for the ray's intersection.
@ -925,7 +924,7 @@ Path.inject(/** @lends Path# */{
if (Curve.isStraight(v) if (Curve.isStraight(v)
|| y0 >= y1 === y1 >= y2 && y1 >= y2 === y2 >= y3) { || y0 >= y1 === y1 >= y2 && y1 >= y2 === y2 >= y3) {
// Straight curves and curves with end and control points sorted // Straight curves and curves with end and control points sorted
// in y direction are guaranteed to be monotone in y direction. // in y direction are guaranteed to be monotonic in y direction.
insertCurve(v); insertCurve(v);
} else { } else {
// Split the curve at y extrema, to get bezier curves with clear // Split the curve at y extrema, to get bezier curves with clear