function clipConvexHull(hullTop, hullBottom, dMin, dMax) {
		var tProxy,
			tVal = null,
			px, py,
			qx, qy;
		for (var i = 0, l = hullBottom.length - 1; i < l; i++) {
			py = hullBottom[i][1];
			qy = hullBottom[i + 1][1];
			if (py < qy) {
				tProxy = null;
			} else if (qy <= dMax) {
				px = hullBottom[i][0];
				qx = hullBottom[i + 1][0];
				tProxy = px + (dMax  - py) * (qx - px) / (qy - py);
			} else {
				// Try the next chain
				continue;
			}
			// We got a proxy-t;
			break;
		}
		if (hullTop[0][1] <= dMax)
			tProxy = hullTop[0][0];
		for (var i = 0, l = hullTop.length - 1; i < l; i++) {
			py = hullTop[i][1];
			qy = hullTop[i + 1][1];
			if (py >= dMin) {
				tVal = tProxy;
			} else if (py > qy) {
				tVal = null;
			} else if (qy >= dMin) {
				px = hullTop[i][0];
				qx = hullTop[i + 1][0];
				tVal = px + (dMin  - py) * (qx - px) / (qy - py);
			} else {
				continue;
			}
			break;
		}
		return tVal;
	}
/**
	 * Clips the convex-hull and returns [tMin, tMax] for the curve contained
	 */
Clips the convex-hull and returns [tMin, tMax] for the curve contained
Clips the convex - hull and returns [ tMin tMax ] for the curve contained
function clipConvexHull(hullTop, hullBottom, dMin, dMax) {
		var tProxy,
			tVal = null,
			px, py,
			qx, qy;
		for (var i = 0, l = hullBottom.length - 1; i < l; i++) {
			py = hullBottom[i][1];
			qy = hullBottom[i + 1][1];
			if (py < qy) {
				tProxy = null;
			} else if (qy <= dMax) {
				px = hullBottom[i][0];
				qx = hullBottom[i + 1][0];
				tProxy = px + (dMax  - py) * (qx - px) / (qy - py);
			} else {
				continue;
			}
			break;
		}
		if (hullTop[0][1] <= dMax)
			tProxy = hullTop[0][0];
		for (var i = 0, l = hullTop.length - 1; i < l; i++) {
			py = hullTop[i][1];
			qy = hullTop[i + 1][1];
			if (py >= dMin) {
				tVal = tProxy;
			} else if (py > qy) {
				tVal = null;
			} else if (qy >= dMin) {
				px = hullTop[i][0];
				qx = hullTop[i + 1][0];
				tVal = px + (dMin  - py) * (qx - px) / (qy - py);
			} else {
				continue;
			}
			break;
		}
		return tVal;
	}
function clipConvexHull ( hullTop , hullBottom , dMin , dMax ) { var tProxy , tVal = null , px , py , qx , qy ; for ( var i = 0 , l = hullBottom . length - 1 ; i < l ; i ++ ) { py = hullBottom [ i ] [ 1 ] ; qy = hullBottom [ i + 1 ] [ 1 ] ; if ( py < qy ) { tProxy = null ; } else if ( qy <= dMax ) { px = hullBottom [ i ] [ 0 ] ; qx = hullBottom [ i + 1 ] [ 0 ] ; tProxy = px + ( dMax - py ) * ( qx - px ) / ( qy - py ) ; } else { continue ; } break ; } if ( hullTop [ 0 ] [ 1 ] <= dMax ) tProxy = hullTop [ 0 ] [ 0 ] ; for ( var i = 0 , l = hullTop . length - 1 ; i < l ; i ++ ) { py = hullTop [ i ] [ 1 ] ; qy = hullTop [ i + 1 ] [ 1 ] ; if ( py >= dMin ) { tVal = tProxy ; } else if ( py > qy ) { tVal = null ; } else if ( qy >= dMin ) { px = hullTop [ i ] [ 0 ] ; qx = hullTop [ i + 1 ] [ 0 ] ; tVal = px + ( dMin - py ) * ( qx - px ) / ( qy - py ) ; } else { continue ; } break ; } return tVal ; }
Clips the convex-hull and returns [tMin, tMax] for the curve contained
Clips the convex - hull and returns [ tMin tMax ] for the curve contained
// Try the next chain // We got a proxy-t;